ROSE  0.9.9.139
rose_attributes_list.h
1 #ifndef __ROSEAttributesList_H__
2 #define __ROSEAttributesList_H__
3 
4 //#include "setup.h"
5 
6 //#include <list>
7 //#include <vector>
8 #include <map>
9 
10 // Include the ROSE lex specific definitions of tokens
11 #include "general_token_defs.h"
12 
13 // #ifdef CAN_NOT_COMPILE_WITH_ROSE
14 // #warning "CAN_NOT_COMPILE_WITH_ROSE IS defined"
15 // #else
16 // #warning "CAN_NOT_COMPILE_WITH_ROSE is NOT defined"
17 // #endif
18 
19 // DQ (2/28/2010): Skip this if we are compiling ROSE using ROSE.
20 // This is being used in place of the CAN_NOT_COMPILE_WITH_ROSE macro.
21 // Note that CAN_NOT_COMPILE_WITH_ROSE is set by the following projects:
22 // 1) projects/DocumentationGenerator
23 // 2) projects/haskellport
24 // in their Makefile.am files. I think that using CXX_IS_ROSE_ANALYSIS
25 // will be equivalent (used to indicate the a ROSE translator is being
26 // used to compile the ROSE source code).
27 // However, it might be that this is equivalent to the USE_ROSE macro,
28 // which is set for all ROSE translators when they compile any code.
29 // DQ (12/22/2008): I would appreciate it if this were a better name...
30 // #if !CAN_NOT_COMPILE_WITH_ROSE
31 // #ifndef USE_ROSE
32 
33 // DQ (5/21/2010): I have built a separate macro for tuning off the compilation of WAVE
34 // since it is done only for the purpose of allowing ROSE based projects:
35 // 1) projects/DocumentationGenerator
36 // 2) projects/haskellport
37 // to process the ROSE files cleanly. ROSE can however process and compile ROSE
38 // (including a slightly modified version of WAVE that EDG will accept) and we
39 // separately test this in noightly tests. The previous 5/18/2010 fix to permit
40 // the Haskell support to skip processign WAVE turned this off and broke the nightly
41 // tests of ROSE compiling ROSE. This use of the macro ROSE_SKIP_COMPILATION_OF_WAVE
42 // it menat to be turned on by ROSE based tools that need to process the ROSE code
43 // and which currently fail (because of Wave) and so turn of the processing of Wave
44 // for those tools.
45 // #ifdef USE_ROSE
46 // #define ROSE_SKIP_COMPILATION_OF_WAVE
47 // #endif
48 
49 // DQ (2/27/2016): Check for DEBIAN and Boost 1.54 and disable WAVE (not found in
50 // Boost 1.54, for Debian OS installations, as I understand it). This is a fix
51 // for a bug identified to be specific to Boost 1.54 on Debian systems, so that
52 // is why it is so specific in deactivating boost::wave. To support this the
53 // boost::wave support had to be revisited to permit it to NOT be a dependence.
54 // We shuld put in place tests that make sure it does not accedently become a
55 // dependence in the future.
56 #ifdef ROSE_DEBIAN_OS_VENDOR
57  #if (ROSE_BOOST_VERSION == 105400)
58  #define ROSE_SKIP_COMPILATION_OF_WAVE
59  #endif
60 #endif
61 
62 // DQ (2/27/2016): Test compilation of ROSE without boost::wave support.
63 // #define ROSE_SKIP_COMPILATION_OF_WAVE
64 
65 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
66 // #if _MSC_VER < 1600 // 1600 == VC++ 10.0
67  #if (!defined(_MSC_VER) || (_MSC_VER > 1600))
68  #include <boost/preprocessor/iteration/iterate.hpp> // Liao, 7/10/2009, required by GCC 4.4.0 for a #define line of BOOST_PP_ITERATION_DEPTH
69  #ifdef _MSC_VER
70  #include <boost/wave.hpp> // CH (4/7/2010): Put this header here to avoid compiling error about mismatch between defination and declaration
71  #endif
72  #include <boost/wave/cpplexer/cpp_lex_token.hpp> // token class
73  #include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer type
74  #else
75 // #warning "Setting CAN_NOT_COMPILE_WITH_ROSE to value = 1"
76 // #define CAN_NOT_COMPILE_WITH_ROSE 1
77 // tps (12/4/2009) : This is not found in VC++ 10.0 and Boost 1.4
78  #pragma message ("Boost preprocessor and wave not included yet for VC++ 10.0")
79 
80  #endif
81 #endif
82 
83 //template boost::wave::cpplexer::impl::token_data<std::string, boost::wave::util::file_position_type>::delete(std::size_t) ;
84 // DQ (10/16/2002): Required for compiling with SUN 5.2 C++ compiler
85 #ifndef NAMESPACE_IS_BROKEN
86 // DQ (12/30/2005): This is a Bad Bad thing to do (I can explain)
87 // it hides names in the global namespace and causes errors in
88 // otherwise valid and useful code. Where it is needed it should
89 // appear only in *.C files (and only ones not included for template
90 // instantiation reasons) else they effect user who use ROSE unexpectedly.
91 // using namespace std;
92 #endif
93 
94 class ROSE_DLL_API PreprocessingInfo;
95 class ROSEAttributesList;
96 //AS(01/04/07) Global map of filenames to PreprocessingInfo*'s as it is inefficient
97 //to get this by a traversal of the AST
98 extern std::map<std::string,ROSEAttributesList* > mapFilenameToAttributes;
99 
100 
101 // DQ (4/19/2006): Forward declaration so that PreprocessingInfo can
102 // contain a pointer to a Sg_File_Info object.
103 class Sg_File_Info;
104 
105 // DQ (1/21/2008): Need forward declaration
106 class SgFile;
107 
108 // #if !CAN_NOT_COMPILE_WITH_ROSE
109 // #ifndef USE_ROSE
110 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
111 
112 typedef boost::wave::cpplexer::lex_token<> token_type;
113 typedef std::vector<token_type> token_container;
114 typedef std::list<token_type> token_list_container;
115 typedef std::vector<std::list<token_type> > token_container_container;
116 
117 #endif
118 
121  {
122  public:
123  // DQ (10/15/2002) moved this to nested scope to avoid global name pollution :-).
127  {
128  defaultValue = 0, // let the zero value be an error value
129  undef = 1, // Position of the directive is only going to be defined
130  // when the preprocessing object is copied into the AST,
131  // it remains undefined before that
132  before = 2, // Directive goes before the correponding code segment
133  after = 3, // Directive goes after the correponding code segment
134  inside = 4, // Directive goes inside the correponding code segment (as in between "{" and "}" of an empty basic block)
135 
136  // DQ (7/19/2008): Added additional fields so that we could use this enum type in the AstUnparseAttribute
137  // replace = 5, // Support for replacing the IR node in the unparsing of any associated subtree
138  before_syntax = 6, // We still have to specify the syntax
139  after_syntax = 7 // We still have to specify the syntax
140  };
141 
142  // Enum type to help classify the type for string that has been saved.
143  // This helps in the unparsing to make sure that line feeds are introduced properly.
144  //
145  // Rama (08/17/07): Adding a CpreprocessorDeadIfDeclaration and its support
146  // in various files.
147  enum DirectiveType
148  {
149  // This is treated as an error
150  CpreprocessorUnknownDeclaration,
151 
152  // These are a classification for comments
153  C_StyleComment,
154  CplusplusStyleComment,
155  FortranStyleComment,
156 
157  // FMZ(5/14/2010): Added freeform comments (started with "!")
158  F90StyleComment,
159 
160  // DQ (11/20/2008): Added classification for blank line (a language independent form of comment).
161  CpreprocessorBlankLine,
162 
163  // These used to be translated into IR nodes (and will be in the future).
164  CpreprocessorIncludeDeclaration,
165  CpreprocessorIncludeNextDeclaration,
166  CpreprocessorDefineDeclaration,
167  CpreprocessorUndefDeclaration,
168  CpreprocessorIfdefDeclaration,
169  CpreprocessorIfndefDeclaration,
170  CpreprocessorIfDeclaration,
171  CpreprocessorDeadIfDeclaration,
172  CpreprocessorElseDeclaration,
173  CpreprocessorElifDeclaration,
174  CpreprocessorEndifDeclaration,
175  CpreprocessorLineDeclaration,
176  CpreprocessorErrorDeclaration,
177 
178  // DQ (10/19/2005): Added CPP warning directive
179  CpreprocessorWarningDeclaration,
180  CpreprocessorEmptyDeclaration,
181 
182  // AS (11/18/05): Added macro support (these are generated by the Wave
183  // support, but need to be better documented as to what they mean).
184  CSkippedToken,
185  CMacroCall,
186 
187  // AS & LIAO (8/12/2008): A PreprocessingInfo that is a
188  // hand made MacroCall that will expand into a valid statement.
189  CMacroCallStatement,
190 
191  // DQ (11/28/2008): What does this mean!
192  // A line replacement will replace a sub-tree in the AST
193  // after a node with position (filename,line)
194  LineReplacement,
195 
196  // The is the 'extern "C" {' construct. Note that this is not captured in
197  // the EDG AST and it is required to be captured as part of the CPP and
198  // comment preprocessing.
199  ClinkageSpecificationStart,
200  ClinkageSpecificationEnd,
201 
202  // DQ (11/17/2008): Added support for #ident
203  CpreprocessorIdentDeclaration,
204 
205  // DQ (11/17/2008): This handles the case CPP declarations (called "linemarkers")
206  // (see Google for more details) such as: "# 1 "test2008_05.F90"", "# 1 "<built-in>"",
207  // "# 1 "<command line>"" "# 1 "test2008_05.F90""
208  // The first token is the line number,
209  // the second token is the filename (or string),
210  // the optional tokens (zero or more) are flags:
211  // '1' indicates the start of a new file.
212  // '2' indicates returning to a file (having included another file).
213  // '3' indicates that the following text comes from a system header file, so certain warnings should be supressed.
214  // '4' indicates that the following text should be treated as being wrapped in an implicit 'extern "C"' block
215  CpreprocessorCompilerGeneratedLinemarker,
216 
217  // DQ (2/2/2014): permit raw text to be specified as a extremely simple way to add text to the unparsing of the AST.
218  // Note that it is the user's responcability to have the text be legal code. Additionall any language constructs
219  // added using this mechanism will ot show up in the AST. So it is not possible to reference functions (for example)
220  // added using this mechanism to build function calls as transformation elsewhere in the code. But one could add
221  // the function via AST transformations and the function body using a mechanism provided here and that would define
222  // a simple appoach to adding large complex functions for which it is impractical to build up an AST.
223  RawText,
224 
225  LastDirectiveType
226  };
227 
228  // DQ (7/10/2004): Make the data private
229  private:
230 
231  // DQ (4/19/2006): Use the SgFileInfo object to hold the more complete
232  // information about the filename, line number, and column number.
233  Sg_File_Info* file_info;
234  // int lineNumber;
235  // int columnNumber;
236 
237  // Use string class to improve implementation
238  // char* stringPointer;
239  std::string internalString;
240 
241  int numberOfLines;
242 
243  // enum value representing a classification of the different types of directives
244  DirectiveType whatSortOfDirective;
245 
246  // Corresponding enum value
247  RelativePositionType relativePosition;
248 
249  // DQ (11/28/2008): Support for CPP generated linemarkers
250  int lineNumberForCompilerGeneratedLinemarker;
251  std::string filenameForCompilerGeneratedLinemarker;
252  std::string optionalflagsForCompilerGeneratedLinemarker;
253 
254  // DQ (1/15/2015): Adding support for token-based unparsing. When new comments and CPP directives are added we need
255  // to record these as a kind of transformation that will trigger the token stream representation to NOT be used and
256  // the comments and CPP directives unparsed from the AST seperately from the associated IR node being unparsed from
257  // the AST. The problem is that we wnat to record where there might be comments or CPP directives removed and having
258  // a flag here is not going to work for that. so we have to also record that the ROSEAttributesList has changed.
259  bool p_isTransformation;
260 
261 // This is part of Wave support in ROSE.
262 // #ifndef USE_ROSE
263  public:
264 /*
265  // AS using the lexer_token from boost_wave in order to store structures
266  typedef boost::wave::cpplexer::lex_token<> token_type;
267  typedef std::vector<token_type> token_container;
268  typedef std::list<token_type> token_list_container;
269  typedef std::vector<std::list<token_type> > token_container_container;
270 */
271  private:
272  // FIXME: To support Jochens AST binary save work the tokenSteam must
273  // have a pointer type.
274 
275 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
276  // A stream of tokens representing the current prerpocessing info
277  // object. This is equivalent to the internal string, but of cause
278  // contains more information since it is a tokenized stream.
279  token_container* tokenStream;
280 
281  public:
282  typedef struct r_include_directive
283  {
284  // The parameter 'directive' contains the (expanded) file name found after
285  // the #include directive. This has the format '<file>', '"file"' or 'file'.
286  token_type directive;
287  // The paths plus name to the include directive filename
288  std::string absname;
289  std::string relname;
291 
292  // Internal representation of a macro #define directive
293  typedef struct r_macro_def
294  {
295  bool is_functionlike;
296  bool is_predefined;
297  token_type macro_name;
298  token_container paramaters;
299  token_list_container definition;
300  r_macro_def() : macro_name(), paramaters(),definition() {}
302 
303  // Internal representation of a macro call
304  // e.g #define MACRO_CALL int x;
305  // MACRO_CALL
306 #if 0
307  typedef struct r_macro_call
308  {
309  bool is_functionlike;
310  PreprocessingInfo* macro_def;
311  token_type macro_call;
312  token_container_container arguments;
313  token_container expanded_macro;
314 
315  // Get string representation of the expanded macro
316  std::string get_expanded_string()
317  {
318  std::ostringstream os;
319  token_container::const_iterator iter;
320  for (iter=expanded_macro.begin(); iter!=expanded_macro.end(); iter++)
321  os << (*iter).get_value();
322  return os.str();
323  }
324 
325  r_macro_call() : macro_call(), arguments(),expanded_macro() {}
326  } rose_macro_call;
327 #else
328  // DQ (3/9/2013): Modified to address SWIG error.
330  {
331  bool is_functionlike;
332  PreprocessingInfo* macro_def;
333  token_type macro_call;
334  token_container_container arguments;
335  token_container expanded_macro;
336 
337  // DQ (3/9/2013): The function definition is moved to the source file to get around SWIG error.
338  // Get string representation of the expanded macro
339  std::string get_expanded_string();
340 
341  // DQ (3/9/2013): The function definition is moved to the source file to get around SWIG error.
342  rose_macro_call();
343  };
344 #endif
345 
346  private:
347  // AS add macro definition
348  rose_macro_definition* macroDef;
349  // AS add macro call
350  rose_macro_call* macroCall;
351  // AS include directive
352  rose_include_directive* includeDirective;
353 
354 #endif
355 
356  // member functions
357  public:
360 
361 // #ifndef USE_ROSE
362 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
363  // AS (112105) Added constructors to support macros
364  PreprocessingInfo(token_container, DirectiveType, RelativePositionType);
367  PreprocessingInfo(token_type, token_list_container, bool, DirectiveType,RelativePositionType);
369 #endif
370 
371  // This constructor is called from the C++ code generated from the lex file (preproc.lex)
372  // PreprocessingInfo(DirectiveType, const char *inputStringPointer, int line_no , int col_no,
373  // int nol, RelativePositionType relPos, bool copiedFlag, bool unparsedFlag) ROSE_DEPRECATED_FUNCTION;
374 
375  // DQ (7/19/2008): I have removed the bool copiedFlag and bool unparsedFlag parameters because they are not used
376  // and are present only because in an older implementation of the unparser it would make the PreprocessingInfo
377  // as unparsed (and maybe copied) but this sort of side-effect of the unparser was later removed to make the
378  // unparsing side-effect free.
379  // DQ (4/19/2006): Use the SgFileInfo object to hold the more complete
380  // information about the filename, line number, and column number.
381  // DQ (3/15/2006): Build constructor that uses C++ string as input (to replace the char* based constructor)
382  // PreprocessingInfo(DirectiveType, const std::string inputString, int line_no , int col_no,
383  // int nol, RelativePositionType relPos, bool copiedFlag, bool unparsedFlag);
384  // PreprocessingInfo(DirectiveType, const std::string & inputString,
385  // const std::string & filenameString, int line_no , int col_no,
386  // int nol, RelativePositionType relPos, bool copiedFlag, bool unparsedFlag );
387  PreprocessingInfo(DirectiveType, const std::string & inputString,
388  const std::string & filenameString, int line_no , int col_no,
389  int nol, RelativePositionType relPos );
390 
391  // Copy constructor
392  PreprocessingInfo(const PreprocessingInfo &prepInfo);
393 
394  void display(const std::string & label) const;
395 
396  // Access functions
397  int getLineNumber() const;
398  int getColumnNumber() const;
399  std::string getString() const;
400  void setString ( const std::string & s );
401  int getStringLength() const;
402  DirectiveType getTypeOfDirective() const;
403  RelativePositionType getRelativePosition(void) const;
404  void setRelativePosition(RelativePositionType relPos);
405 
406  // Number of lines occupied by this comment (count the number of line feeds)
407  int getNumberOfLines() const;
408  int getColumnNumberOfEndOfString() const; // only correct for single line directives
409 
410  // Used in unparse to string mechanism
411  // char* removeLeadingWhiteSpace (const char* inputStringPointer);
412 
413  // DQ (8/6/2006): Modified to make these static functions
414  // useful for debugging
415  static std::string directiveTypeName (const DirectiveType & directive);
416  static std::string relativePositionName (const RelativePositionType & position);
417 
418  // JH (01/03/2006) methods for packing the PreprocessingInfo data, in order to store it into
419  // a file and rebuild it!
420  unsigned int packed_size () const;
421 
422  // JH (01/032006) This pack methods might cause memory leaks. Think of deleting them after stored to file ...
423  char* packed() const;
424  void unpacked( char* storePointer );
425 
426  // DQ (4/19/2006): Added Sg_File_Info objects to each PreprocessingInfo object
427  Sg_File_Info* get_file_info() const;
428  void set_file_info( Sg_File_Info* info );
429 
430 
431  // DQ (11/28/2008): Support for CPP generated linemarkers
432  int get_lineNumberForCompilerGeneratedLinemarker();
433  std::string get_filenameForCompilerGeneratedLinemarker();
434  std::string get_optionalflagsForCompilerGeneratedLinemarker();
435 
436  // DQ (11/28/2008): Support for CPP generated linemarkers
437  void set_lineNumberForCompilerGeneratedLinemarker( int x );
438  void set_filenameForCompilerGeneratedLinemarker( std::string x );
439  void set_optionalflagsForCompilerGeneratedLinemarker( std::string x );
440 
441 // #ifndef USE_ROSE
442 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
443  // Wave specific member functions.
444  public:
445  // Access functions to get the macro call or macro definition.
446  // These are NULL if the type is not CMacroCall or
447  // CpreprocessorDefineDeclaration
448  rose_macro_call* get_macro_call();
449  rose_macro_definition* get_macro_def();
450  rose_include_directive* get_include_directive();
451 
452  const token_container* get_token_stream();
453  void push_front_token_stream(token_type tok);
454  void push_back_token_stream(token_type tok);
455 
456 #endif
457 
458  // DQ (12/30/2013): Adding support to supress output of macros that are self-referential.
459  // e.g. "#define foo X->foo", which would be expanded a second time in the backend processing.
460  // Note that if we don't output the #define, then we still might have a problem if there was
461  // code that depended upon a "#ifdef foo". So this handling is not without some risk, but it
462  // always better to use the token stream unparsing for these cases.
463  bool isSelfReferential();
464  std::string getMacroName();
465 
466  // DQ (1/15/2015): Adding support for token-based unparsing. Access function for new data member.
467  bool isTransformation() const;
468  void setAsTransformation();
469  void unsetAsTransformation();
470  };
471 
472 // DQ (10/15/2002) Changed list element from "PreprocessingInfo" to
473 // "PreprocessingInfo*" to avoid redundant copying of internal data.
474 // Define a new data type for the container that stores the
475 // PreprocessingInfo objects attached to an AST node
476 typedef Rose_STL_Container<PreprocessingInfo*> AttachedPreprocessingInfoType;
477 
479  {
480  private:
481  // DQ replaced use of old list class with STL
482  std::vector<PreprocessingInfo*> attributeList;
483 
484  LexTokenStreamTypePointer rawTokenStream;
485 
486  // [DT] 3/15/2000 -- Name of file from which the directives come.
487  // char fileName[256];
488  std::string fileName;
489 
490  // 3/16/2000 -- Index into the list. Not sure if this is really
491  // necessary. See implementation in unparser.C.
492  //
493  // This is where the current line number is stored while we
494  // go off and unparse a different include file. This really should have
495  // been stored in a static structure (I think) rather than in this list.
496  int index;
497 
498  // DQ (12/15/2012): Save file ids that are from filenames referenced in #line
499  // directives, these will be considered equivalent to the input source filename.
500  std::set<int> filenameIdSet;
501 
502  // DQ (1/15/2015): Adding support for token-based unparsing. When new comments and CPP directives are added we need
503  // to record these as a kind of transformation that will trigger the token stream representation to NOT be used and
504  // the comments and CPP directives unparsed from the AST seperately from the associated IR node being unparsed from
505  // the AST. The problem is that we wnat to record where there might be comments or CPP directives removed and having
506  // a flag here is not going to work for that. so we have to also record that the ROSEAttributesList has changed.
507  // bool p_isTransformation;
508 
509  public:
510  // DQ (11/19/2008): Added language selection support for handling comments
511  enum languageTypeEnum
512  {
513  e_unknown_language = 0,
514  e_C_language = 1,
515  e_Cxx_language = 2,
516  e_Fortran77_language = 3,
517  e_Fortran9x_language = 4,
518  e_lastLanguage
519  };
520 
523  // DQ (4/19/2006): Adding SgFileInfo objects so we need to pass in a filename string
524  // void addElement(PreprocessingInfo::DirectiveType, const char *pLine, int lineNumber, int columnNumber, int numberOfLines);
525  void addElement(PreprocessingInfo::DirectiveType, const std::string & pLine, const std::string & filename, int lineNumber, int columnNumber, int numberOfLines);
526 #if 1
527  // DQ (5/9/2007): This is required for WAVE support.
528  // DQ (4/13/2007): I would like to remove this function, but it is used by WAVE support within ROSE.
529  void addElement( PreprocessingInfo &pRef );
530 #endif
531  // void addElements( ROSEAttributesList &);
532  void moveElements( ROSEAttributesList &);
533 
534 #if 1
535  // DQ (5/9/2007): This is required for WAVE support.
536  // DQ (4/13/2007): I would like to remove this function
537  void insertElement( PreprocessingInfo & pRef );
538 #endif
539 
540  // [DT] 3/15/2000 -- Interface to fileName member.
541  void setFileName(const std::string & fName);
542  std::string getFileName();
543 
544  // 3/16/2000 -- Interface to index member.
545  void setIndex(int i);
546  int getIndex();
547 
548  PreprocessingInfo* operator[](int i);
549  int size(void);
550  int getLength(void);
551  void deepClean(void);
552  void clean(void);
553 
554  // DQ (9/19/2013): generate the number associated with each position relative to the attached IR node.
555  // size_t numberByRelativePosition(PreprocessingInfo::RelativePositionType pos);
556 
557  // Access function for list
558  std::vector<PreprocessingInfo*> & getList() { return attributeList; };
559 
560  void display ( const std::string & label ); // DQ 02/18/2001 -- For debugging.
561 
562  // DQ (1/21/2008): Added access function to save the raw token stream from the lex pass.
563  void set_rawTokenStream( LexTokenStreamTypePointer s );
564  LexTokenStreamTypePointer get_rawTokenStream();
565 
566  // This function processes the token stream to generate the input for what weaves the
567  // CPP directives and comments into the AST. All other tokens are ignore in this pass.
568  void generatePreprocessorDirectivesAndCommentsForAST( const std::string & filename );
569 
570  // DQ (11/26/2008): This is old code!
571  // Collection comments and CPP directives for fixed format (easier case)
572  // void collectFixedFormatPreprocessorDirectivesAndCommentsForAST( const std::string & filename );
573 
574  // DQ (11/16/2008): Adding support for recognition of CPP directives outside of the lex tokenization.
575  void collectPreprocessorDirectivesAndCommentsForAST( const std::string & filename, languageTypeEnum languageType );
576 
577  // DQ (11/17/2008): Refactored the code.
578  bool isFortran77Comment( const std::string & line );
579  bool isFortran90Comment( const std::string & line );
580  bool isCppDirective( const std::string & line, PreprocessingInfo::DirectiveType & cppDeclarationKind, std::string & restOfTheLine );
581 
582  // DQ (12/15/2012): traverse the attributeList and process all of the #line directives to generate a
583  // list of file ids that should be considered equivalent to that of the input source file's filename.
584  // std::set<int> generateFileIdListFromLineDirectives();
585  void generateFileIdListFromLineDirectives();
586 
587  // DQ (12/15/2012): Added access function.
588  std::set<int> & get_filenameIdSet();
589 
590  // DQ (9/29/2013): Added to support adding processed CPP directives and comments as tokens to token list.
591  PreprocessingInfo* lastElement();
592 
593  // DQ (1/15/2015): Adding support for token-based unparsing. Access function for new data member.
594  // bool isTransformation() const;
595  // void setAsTransformation();
596  // void unsetAsTransformation();
597  };
598 
599 //
600 // [DT] 3/16/2000 -- Want to have preprocessing info for
601 // each file included from the main source file.
602 //
604  {
605  private:
606  // DQ replaced use of old list class with STL
607  // std::vector<ROSEAttributesList*> attributeListList;
608  // std::map<std::string,ROSEAttributesList*>* attrMap;
609  std::map<std::string, ROSEAttributesList*> attributeListMap;
610 
611  public:
614  // void addList ( ROSEAttributesList* listPointer );
615  void addList ( std::string fileName, ROSEAttributesList* listPointer );
616  // void addList(ROSEAttributesList &aRef);
617  // void insertList(ROSEAttributesList &aRef);
618  // ROSEAttributesList* operator[](int i);
619  // ROSEAttributesList* findList ( const std::string & fName );
620 
621  // Check to see if the ROSEAttributesList for the fName (filename) is in the container
622  bool isInList ( const std::string & fName );
623 
624  // int size(void);
625  // int getLength(void);
626  void dumpContents(void); // [DT] 3/16/2000 -- For debugging.
627  void deepClean(void);
628  void clean(void);
629  ROSEAttributesList & operator[]( const std::string & fName);
630 
631  // Access function for list
632  // std::vector<ROSEAttributesList*> & getList() { return attributeListList; };
633  std::map<std::string, ROSEAttributesList*> & getList() { return attributeListMap; };
634  void display ( const std::string & label ); // DQ 02/18/2001 -- For debugging.
635  };
636 
637 
638 // #ifndef USE_ROSE
639 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
640 
641 extern token_container wave_tokenStream;
642 
643 #endif
644 
645 #endif
This class represents a source file for a project (which may contian many source files and or directo...
This class represents the location of the code associated with the IR node in the original source cod...
RelativePositionType
MK: Enum type to store if the directive goes before or after the corresponding line of source code...
For preprocessing information including source comments, #include , #if, #define, etc...