ROSE  0.9.10.200
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  // DQ (2/27/2019): Adding support for CPP directives and comments to have filename information (already present, but we need to access it).
407  std::string getFilename() const;
408  int getFileId() const;
409 
410  // Number of lines occupied by this comment (count the number of line feeds)
411  int getNumberOfLines() const;
412  int getColumnNumberOfEndOfString() const; // only correct for single line directives
413 
414  // Used in unparse to string mechanism
415  // char* removeLeadingWhiteSpace (const char* inputStringPointer);
416 
417  // DQ (8/6/2006): Modified to make these static functions
418  // useful for debugging
419  static std::string directiveTypeName (const DirectiveType & directive);
420  static std::string relativePositionName (const RelativePositionType & position);
421 
422  // JH (01/03/2006) methods for packing the PreprocessingInfo data, in order to store it into
423  // a file and rebuild it!
424  unsigned int packed_size () const;
425 
426  // JH (01/032006) This pack methods might cause memory leaks. Think of deleting them after stored to file ...
427  char* packed() const;
428  void unpacked( char* storePointer );
429 
430  // DQ (4/19/2006): Added Sg_File_Info objects to each PreprocessingInfo object
431  Sg_File_Info* get_file_info() const;
432  void set_file_info( Sg_File_Info* info );
433 
434 
435  // DQ (11/28/2008): Support for CPP generated linemarkers
436  int get_lineNumberForCompilerGeneratedLinemarker();
437  std::string get_filenameForCompilerGeneratedLinemarker();
438  std::string get_optionalflagsForCompilerGeneratedLinemarker();
439 
440  // DQ (11/28/2008): Support for CPP generated linemarkers
441  void set_lineNumberForCompilerGeneratedLinemarker( int x );
442  void set_filenameForCompilerGeneratedLinemarker( std::string x );
443  void set_optionalflagsForCompilerGeneratedLinemarker( std::string x );
444 
445 // #ifndef USE_ROSE
446 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
447  // Wave specific member functions.
448  public:
449  // Access functions to get the macro call or macro definition.
450  // These are NULL if the type is not CMacroCall or
451  // CpreprocessorDefineDeclaration
452  rose_macro_call* get_macro_call();
453  rose_macro_definition* get_macro_def();
454  rose_include_directive* get_include_directive();
455 
456  const token_container* get_token_stream();
457  void push_front_token_stream(token_type tok);
458  void push_back_token_stream(token_type tok);
459 
460 #endif
461 
462  // DQ (12/30/2013): Adding support to supress output of macros that are self-referential.
463  // e.g. "#define foo X->foo", which would be expanded a second time in the backend processing.
464  // Note that if we don't output the #define, then we still might have a problem if there was
465  // code that depended upon a "#ifdef foo". So this handling is not without some risk, but it
466  // always better to use the token stream unparsing for these cases.
467  bool isSelfReferential();
468  std::string getMacroName();
469 
470  // DQ (1/15/2015): Adding support for token-based unparsing. Access function for new data member.
471  bool isTransformation() const;
472  void setAsTransformation();
473  void unsetAsTransformation();
474  };
475 
476 // DQ (10/15/2002) Changed list element from "PreprocessingInfo" to
477 // "PreprocessingInfo*" to avoid redundant copying of internal data.
478 // Define a new data type for the container that stores the
479 // PreprocessingInfo objects attached to an AST node
480 typedef Rose_STL_Container<PreprocessingInfo*> AttachedPreprocessingInfoType;
481 
483  {
484  private:
485  // DQ replaced use of old list class with STL
486  std::vector<PreprocessingInfo*> attributeList;
487 
488  LexTokenStreamTypePointer rawTokenStream;
489 
490  // [DT] 3/15/2000 -- Name of file from which the directives come.
491  // char fileName[256];
492  std::string fileName;
493 
494  // 3/16/2000 -- Index into the list. Not sure if this is really
495  // necessary. See implementation in unparser.C.
496  //
497  // This is where the current line number is stored while we
498  // go off and unparse a different include file. This really should have
499  // been stored in a static structure (I think) rather than in this list.
500  int index;
501 
502  // DQ (12/15/2012): Save file ids that are from filenames referenced in #line
503  // directives, these will be considered equivalent to the input source filename.
504  std::set<int> filenameIdSet;
505 
506  // DQ (1/15/2015): Adding support for token-based unparsing. When new comments and CPP directives are added we need
507  // to record these as a kind of transformation that will trigger the token stream representation to NOT be used and
508  // the comments and CPP directives unparsed from the AST seperately from the associated IR node being unparsed from
509  // the AST. The problem is that we wnat to record where there might be comments or CPP directives removed and having
510  // a flag here is not going to work for that. so we have to also record that the ROSEAttributesList has changed.
511  // bool p_isTransformation;
512 
513  public:
514  // DQ (11/19/2008): Added language selection support for handling comments
515  enum languageTypeEnum
516  {
517  e_unknown_language = 0,
518  e_C_language = 1,
519  e_Cxx_language = 2,
520  e_Fortran77_language = 3,
521  e_Fortran9x_language = 4,
522  e_lastLanguage
523  };
524 
527  // DQ (4/19/2006): Adding SgFileInfo objects so we need to pass in a filename string
528  // void addElement(PreprocessingInfo::DirectiveType, const char *pLine, int lineNumber, int columnNumber, int numberOfLines);
529  void addElement(PreprocessingInfo::DirectiveType, const std::string & pLine, const std::string & filename, int lineNumber, int columnNumber, int numberOfLines);
530 #if 1
531  // DQ (5/9/2007): This is required for WAVE support.
532  // DQ (4/13/2007): I would like to remove this function, but it is used by WAVE support within ROSE.
533  void addElement( PreprocessingInfo &pRef );
534 #endif
535  // void addElements( ROSEAttributesList &);
536  void moveElements( ROSEAttributesList &);
537 
538 #if 1
539  // DQ (5/9/2007): This is required for WAVE support.
540  // DQ (4/13/2007): I would like to remove this function
541  void insertElement( PreprocessingInfo & pRef );
542 #endif
543 
544  // [DT] 3/15/2000 -- Interface to fileName member.
545  void setFileName(const std::string & fName);
546  std::string getFileName();
547 
548  // 3/16/2000 -- Interface to index member.
549  void setIndex(int i);
550  int getIndex();
551 
552  PreprocessingInfo* operator[](int i);
553  int size(void);
554  int getLength(void);
555  void deepClean(void);
556  void clean(void);
557 
558  // DQ (9/19/2013): generate the number associated with each position relative to the attached IR node.
559  // size_t numberByRelativePosition(PreprocessingInfo::RelativePositionType pos);
560 
561  // Access function for list
562  std::vector<PreprocessingInfo*> & getList() { return attributeList; };
563 
564  void display ( const std::string & label ); // DQ 02/18/2001 -- For debugging.
565 
566  // DQ (1/21/2008): Added access function to save the raw token stream from the lex pass.
567  void set_rawTokenStream( LexTokenStreamTypePointer s );
568  LexTokenStreamTypePointer get_rawTokenStream();
569 
570  // This function processes the token stream to generate the input for what weaves the
571  // CPP directives and comments into the AST. All other tokens are ignore in this pass.
572  void generatePreprocessorDirectivesAndCommentsForAST( const std::string & filename );
573 
574  // DQ (11/26/2008): This is old code!
575  // Collection comments and CPP directives for fixed format (easier case)
576  // void collectFixedFormatPreprocessorDirectivesAndCommentsForAST( const std::string & filename );
577 
578  // DQ (11/16/2008): Adding support for recognition of CPP directives outside of the lex tokenization.
579  void collectPreprocessorDirectivesAndCommentsForAST( const std::string & filename, languageTypeEnum languageType );
580 
581  // DQ (11/17/2008): Refactored the code.
582  bool isFortran77Comment( const std::string & line );
583  bool isFortran90Comment( const std::string & line );
584  bool isCppDirective( const std::string & line, PreprocessingInfo::DirectiveType & cppDeclarationKind, std::string & restOfTheLine );
585 
586  // DQ (12/15/2012): traverse the attributeList and process all of the #line directives to generate a
587  // list of file ids that should be considered equivalent to that of the input source file's filename.
588  // std::set<int> generateFileIdListFromLineDirectives();
589  void generateFileIdListFromLineDirectives();
590 
591  // DQ (12/15/2012): Added access function.
592  std::set<int> & get_filenameIdSet();
593 
594  // DQ (9/29/2013): Added to support adding processed CPP directives and comments as tokens to token list.
595  PreprocessingInfo* lastElement();
596 
597  // DQ (1/15/2015): Adding support for token-based unparsing. Access function for new data member.
598  // bool isTransformation() const;
599  // void setAsTransformation();
600  // void unsetAsTransformation();
601  };
602 
603 //
604 // [DT] 3/16/2000 -- Want to have preprocessing info for
605 // each file included from the main source file.
606 //
608  {
609  private:
610  // DQ replaced use of old list class with STL
611  // std::vector<ROSEAttributesList*> attributeListList;
612  // std::map<std::string,ROSEAttributesList*>* attrMap;
613  std::map<std::string, ROSEAttributesList*> attributeListMap;
614 
615  public:
618  // void addList ( ROSEAttributesList* listPointer );
619  void addList ( std::string fileName, ROSEAttributesList* listPointer );
620  // void addList(ROSEAttributesList &aRef);
621  // void insertList(ROSEAttributesList &aRef);
622  // ROSEAttributesList* operator[](int i);
623  // ROSEAttributesList* findList ( const std::string & fName );
624 
625  // Check to see if the ROSEAttributesList for the fName (filename) is in the container
626  bool isInList ( const std::string & fName );
627 
628  // int size(void);
629  // int getLength(void);
630  void dumpContents(void); // [DT] 3/16/2000 -- For debugging.
631  void deepClean(void);
632  void clean(void);
633  ROSEAttributesList & operator[]( const std::string & fName);
634 
635  // Access function for list
636  // std::vector<ROSEAttributesList*> & getList() { return attributeListList; };
637  std::map<std::string, ROSEAttributesList*> & getList() { return attributeListMap; };
638  void display ( const std::string & label ); // DQ 02/18/2001 -- For debugging.
639  };
640 
641 
642 // #ifndef USE_ROSE
643 #ifndef ROSE_SKIP_COMPILATION_OF_WAVE
644 
645 extern token_container wave_tokenStream;
646 
647 #endif
648 
649 #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...