Commit Graph

148 Commits

Author SHA1 Message Date
Pappy Van Winkle
af2575da5b Remove all unused variables (style warning). 2018-10-11 22:05:50 -05:00
Alex Lin
6ce60cb2ec Is Trick ICG missing some uses of TRICK_ICG #608
Some functions changed signatures in 3.5, others in 3.7.
2018-05-18 08:38:28 -05:00
Alex Lin
be6f9dc855 Trick will not compile with llvm 6.0 and Xcode 9.2 on the mac. #579
Found a new language option we need to set in ICG when llvm >= 6.0 to parse
header files correctly.  The option is DoubleSquareBracketAttributes.
2018-05-07 16:26:20 -05:00
Alex Lin
f412125715 Is Trick ICG missing some uses of TRICK_ICG #608
Yes, it is, it's missing all of them.  Any clang/llvm version 3.5 and
above.  So it's been broken for a while.  We inherit from a
clang class that processes preprocessing statements.  If we override
virtual functions of a certain signature, we can inject our code into
the preprocessing process.  In this case we're looking for the use
of TRICK_ICG.  Clang changed the function signature in version 3.5.
From 3.5 on our functions were never called, so we never would find
TRICK_ICG.  I created new signatures for the functions post 3.5 so
they will work again.
2018-04-23 16:40:32 -05:00
Thadeus Fleming
db07582616 Only left-shift FieldDescription::io when io_found == true
The `io` field of `FieldDescription` takes a default value of 15. In
`FieldDescription::parseComment`, it may be updated as specified in the comment
text. There are 4 possible cases:

1) Neither IO attributes nor checkpoint IO attributes are found in the comment
2) IO attributes are found in the comment, but checkpoint IO attributes are not
3) Checkpoint IO attributes are found in the comment, but IO attributes are not
4) Both IO attributes and checkpoint IO attributes are found in the comment

In case 2, the IO attributes are copied into the checkpoint IO attributes by the
statement `io |= (io << 2)`. However, this also erroneously runs in case 1,
causing the default value of 15 to change to 63.

By testing `io_found == true`, this logic occurs only in case 2.

Fixes #568
2018-03-27 09:37:26 -05:00
Derek Bankieris
050e552d7c Update ICG for clang 6
Fixes #578
2018-03-13 09:30:01 -05:00
Alex Lin
54b57bc351 Pointers to STLs cannot be checkpointed. #552
Added code to disable printing of STLs if it is arrayed or has pointer
dimensions.
2018-01-25 09:40:23 -06:00
Alex Lin
c694700148 Add environment variable to ignore types from ICG processing #535
Added a new environment variable TRICK_ICG_IGNORE_TYPES.  Class/struct/enum
types found in this semicolon delimited list will not have attributes written
out.
2017-12-19 10:02:41 -06:00
Alex Lin
9509924b64 Don't create attributes for class members that are of private embedded class types #534
Test the class field type.  If the type is a private embedded class mark the field
as io=0 so we don't create attributes for the field.
2017-12-19 08:26:52 -06:00
Alex Lin
5285f1a72e Symbolic links rise again #530
Found more places where symbolic links cause havoc.  Also added back a #define
that was removed in parameter_types.h and added back the messaging routines to
the list swig processes.
2017-12-12 10:17:24 -06:00
Thadeus Fleming
143d0f2c41 Make object .d files order-only prerequisites
This will ensure objects are rebuilt only due to a missing dependency
file, not a newer one.

Fixes #501.
2017-11-02 12:34:48 -05:00
Alex Lin
de012dde71 Feature request: Support checkpointing and logging of std::array #480
Added std::array as an STL type Trick recognizes.  We can now create io code
that can save and restore std::arrays like std::vectors and other similar
types. Like other STL types, an std::array cannot be logged or viewed in
trick-tv.
2017-09-27 16:01:52 -05:00
Alex Lin
c6ecd76be5 ICG does not compile with llvm 5.0 #476
Added a preprocessor check for llvm version >= 5.  If true use
clang::InputKind::CXX instead of clang::IK_CXX
2017-09-13 14:07:23 -05:00
Alex Lin
70a81acc6c ICG handling of \brief in comments differs on Linux and Mac #453
Adjusted regular expression so it will work on the mac.  Changed "\w" to
"[a-zA-Z0-9]".
2017-08-21 14:03:49 -05:00
Alex Lin
9207bd0ab1 io_src makefile applying TRICK_SYSTEM_CXXFLAGS to all compilation units. #470
Changed TRICK_SYSTEM_CXXFLAGS in Makefile_io_src to TRICK_IO_CXXFLAGS.
2017-08-21 13:28:28 -05:00
Alex Lin
e2693de992 Many Trick sims SEGFAULT when built in 32-bit mode #440
Added a switch to trick-ICG to handle the -m32 flag.  When the
flag is present we tell clang to use a 32bit layout when calculating
member offsets.
2017-06-19 14:18:37 -05:00
Derek Bankieris
1dbeb3e2d4 Fix io code for classes with excluded parents
Check the return value of CXXRecordVisitor::TraverseCXXRecordDecl and
don't add information from excluded parents.
Add a parameter to PrintAttributes::isHeaderExcluded to toggle exlusion
of TRICK_EXT_LIB_DIRS paths. When traversing a CXX record, we don't
actually want to skip these paths since their io code should exist in
the Trickified library.
Fix memory leak.

Refs #435
2017-05-24 10:51:27 -05:00
Derek Bankieris
05b4d09b2b Sanitize field names when generating STL functions
A sanitizing function was already present in FieldVisitor.cpp. I
refactored and moved it to Utilities.
Refs #429
2017-05-22 10:37:20 -05:00
Derek Bankieris
fe79aa81a5 Improve printable field detection
Renamed determinePrintAttr to isPrintable.
Different callers need to filter on different IO specs, so I added an
ioMask parameter.
Additional refactoring.
Refs #427
2017-05-17 09:37:22 -05:00
Derek Bankieris
353905c1ed Generate STL functions only when requested
Remove STL prototypes. They don't appear to be necessary anymore.
Refs #427
2017-05-16 15:31:08 -05:00
Alex Lin
a11e51cce7 Sim build doesn't stop on error #421
When I added the "tee" commands to split off command outputs to
a file and the screen, I forgot that the exit status of the make commands
takes the exit status of "tee" which does not ususally have an error and
masks any error in the actual compilation.  I added an exit ${PIPESTATUS[0]}
which returns the exit status of the compilation.
2017-05-15 13:36:06 -05:00
Alex Lin
b2ebe157ed Lost the MAKE_out file when we updated simulation makefiles #412
Added echos to all compile commands to append to MAKE_out.  tee'd
the output of the compile command so that it will go to both the MAKE_out
file and the screen.
2017-04-18 10:26:58 -05:00
Derek Bankieris
b53c52ac33 Separate ICG & SWIG exclusion constructs
Refs #392
2017-03-27 15:19:43 -05:00
Derek Bankieris
73cbbd96cd Refactor ICG to report skipped files consistently
Refs #394
2017-03-15 15:53:56 -05:00
Alex Lin
b88c75631a Missing includes when using clang/llvm 4.0 #393
Added some missing header file includes.
2017-03-15 10:05:06 -05:00
Derek Bankieris
2e4c3286a3 Automatically generate dependencies with SWIG
Like gcc, swig supports all those -M options. Use them to automatically
manage *_py.cpp dependencies.
Add dependency generation to trickify.mk as well.
2017-03-14 13:38:09 -05:00
Alex Lin
a1bc45548b tool for detecting mismatch between friend init_attr and containing class #371
Added a check and warning message in ICG that warns you if a friend function
starts with "init_attr" but does not match the current class name.
2017-03-10 09:38:33 -06:00
Derek Bankieris
e6ad95f493 Grand Make Dependency Graph, part 1
Refs #360
2017-02-23 13:26:28 -06:00
Derek Bankieris
d965f4b0a8 Infer TRICK_HOME automatically
Refs #358
2017-02-10 10:29:56 -06:00
Alex Lin
337139cacb S_overrides.mk is included twice when building #360
A different approach.  Instead of trying to limit the number of times
S_overrides.mk is included, combine the makefiles so only one
call to make is made.
2017-02-09 09:46:58 -06:00
Alex Lin
38d2b10b9e Forward-declared classes aren't fully populated in S_sie.resource #378
I chose the wrong call when trying to support clang 3.9 and it's
removal of getRBraceLoc.  The best equivalent call in 3.9 is
getBraceRange().getEnd().
2017-01-23 17:48:16 -06:00
Alex Lin
8a0653fa09 Detect when TRICK_ICG is used in header files and compensate for it. #375
clang call to addPPCallbacks changed between clang versions 3.5 and 3.6.
2017-01-12 08:42:16 -06:00
Alex Lin
9f01209316 ICG generates non-compilable io_* code for std::vector::iterator members #331
Added a test if our field is an iterator type.  If it is we cannot create io_src
code for it.  We skip it once identified.
2017-01-11 16:07:02 -06:00
Alex Lin
b60320464a Detect when TRICK_ICG is used in header files and compensate for it. #375
Always differences between clang versions.
2017-01-11 15:59:10 -06:00
Alex Lin
ba47c2048c Detect when TRICK_ICG is used in header files and compensate for it. #375
Created a hook for the clang preprocessor.  The hook does 2 things.  It
keeps track to which header files we have entered and exited.  Second it
searches for the use of TRICK_ICG.  If we find an instance of TRICK_ICG we
mark all of the included files from this point up the chain as requiring
compensation.  To compensate for using TRICK_ICG we write out the older
offset statements to get the location of variables in classes/structures.
2017-01-11 15:02:21 -06:00
Thadeus Fleming
fb1925e0d8 Use std::cerr instead of std::cout for error messages 2016-12-10 11:49:44 -06:00
Michael Vetter
18f0d7e871 Remove trailing whitespaces
Makes it easier to edit the files. So if we press 'end of line' we are
really at the end of line.
2016-11-08 10:25:07 +01:00
Alex Lin
d875f837f2 ICG produces non-compilable io_* code for this weird example #334
When saving the list of namespaces and classes a particular type is contained in
we have to save the class name and any template args it includes separately.  This
allows us to mangle the names easier.  And we now search for type names to see
if they follow this pattern template_name<template_args>::embedded_class.  If
we are using a template embedded class we need to create attributes for the embedded class.
2016-11-02 13:56:40 -05:00
Derek Bankieris
664797e391 Move one-time-use variables into their call site #341 2016-10-31 10:00:48 -05:00
Derek Bankieris
29b0d2d223 Alex doesn't like auto #341
Granted, there are times you shouldn't hide the type.
2016-10-31 09:51:44 -05:00
Derek Bankieris
5898f3fdec Improve loop efficiency #341
Calling getTemplateArgs() every iteration is wasteful. This should
be done once outside of the loop. Even better, use a foreach loop and
get rid of the index varible!
2016-10-31 09:34:24 -05:00
Derek Bankieris
bdcfbb4e3a Restore debug functions #341 2016-10-31 09:10:33 -05:00
Derek Bankieris
ef1405c3be Refactor ICG
Hey buddy. I wanted to tell you this before you heard it from someone
else...

I refactored ICG.

Now, it's gonna look a little scary at first. But I promise you'll like
it when you get used to it. It'll be fine. You can trust me. #341
2016-10-28 14:37:12 -05:00
Alex Lin
ba75f6ff37 ICG does not compile using llvm 3.9 #339
The call getRBraceLoc to find the ending source location of things is gone.  Replaced
it with getting the source range and get the end of that range.  Also the way to
get clang/llvm 3.9 to process c++11 code required some reordering of calls in main as
well as adding some more features to be turned on.
2016-10-28 13:21:21 -05:00
Derek Bankieris
0ba68e40aa Merge branch 'master' of https://github.com/nasa/trick
Conflicts:
	trick_source/codegen/Interface_Code_Gen/main.cpp
2016-10-21 15:15:41 -05:00
Derek Bankieris
015965abab Renamed most variabes so that they are self-descriptive. Stop using abbreviations! No one can tell what anything is.
Applied a consistent formatting.
Inlined several one-off variables.
2016-10-21 15:06:44 -05:00
Derek Bankieris
108d3d40c5 Added a version of almostRealPath that takes a const std::string& parameter so we don't have to use c_str() everywhere 2016-10-21 15:06:35 -05:00
Derek Bankieris
75c35752d6 Spacing 2016-10-21 15:05:26 -05:00
Alex Lin
a2452aacd0 ICG creates offsetof statements that will not compile when using clang #327
When copying inherited variables to a child class in ICG, the inherited flags
were not being set on the mac.
2016-10-21 13:13:43 -05:00
Alex Lin
f1cbacd646 ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
This changes back the default behavior to not use offsetof in io_src code.
Added a flag to ICG, -c or --compat15, to globally generate offsetof statements.
Added an ENV variable that can be used to generate offsetof statements by file or directory.
Added in a warning if classes parsed at ICG time are different in size than at runtime.
2016-10-21 13:13:43 -05:00