ROSE  0.11.145.0
attachPreprocessingInfo.h
1 // Header file to support attaching preprocessingInfo objects
2 // to AST nodes
3 
4 #ifndef _ATTACH_PREPROCESSING_INFO_H_
5 #define _ATTACH_PREPROCESSING_INFO_H_
6 
7 #include "attachPreprocessingInfoTraversal.h"
8 
9 
10 // DQ (4/5/2006): Andreas has removed this code!
11 
12 // void printOutComments ( SgLocatedNode* locatedNode );
13 
14 // DQ (1/4/2021): Adding support for comments and CPP directives and tokens to use new_filename.
15 // This function is defined in preproc.C and used to collect the attributes
16 // extern ROSEAttributesList *getPreprocessorDirectives(const char *fileName);
17 // extern ROSEAttributesList *getPreprocessorDirectives(const char *fileName);
18 // ROSEAttributesList *getPreprocessorDirectives(const char *fileName);
19 // ROSEAttributesList *getPreprocessorDirectives( std::string fileName );
20 // ROSEAttributesList *getPreprocessorDirectives( std::string fileName, LexTokenStreamTypePointer & input_token_stream_pointer );
21 // ROSEAttributesList *getPreprocessorDirectives( std::string fileName );
22 ROSEAttributesList *getPreprocessorDirectives( std::string fileName, std::string new_filename = "");
23 
24 
25 // DQ (12/3/2020): We sometimes want to read a file twice, and gather the comments
26 // and CPP directives twice, but the second time the file is read it is read so that
27 // it can build a file with a different name. So we need to specify the name of the
28 // file that we want the comments and CPP directives to eventually be attached to
29 // and not the one from which they were take. This technique is used to support
30 // building a second file to be a dynamic library within the codeSegregation tool.
31 // void attachPreprocessingInfo(SgSourceFile *sageFile);
32 void attachPreprocessingInfo(SgSourceFile *sageFile, const std::string & new_filename = "");
33 
34 // DQ (11/30/2008): Part of refactoring of code specific to Wave.
35 void attachPreprocessingInfoUsingWave(SgSourceFile *sageFile);
36 
37 #if 0
38 // DQ (12/16/2008): comment out while I debug the non-wave support.
39 
40 // AS (012006) Added the function
41 // void attachPreprocessingInfo(SgFile *sageFile, std::map<string,ROSEAttributesList*>*);
42 // to support reintroductions of macros and fetching of preprocessor directive using Wave.
43 // This function does not in itself rely on Wave, but simply takes the same arguement as
44 // 'attachPreprocessingInfo(SgFile *sageFile)', but adds an argument std::map<string,ROSEAttributesList*>*
45 // which is a map of a pair (filename,list of attributes in that file). The two functions will perform
46 // the same tasks in all ways but the way they find the preprocessor directives. In addition to that
47 // the mechanism here opens up for reintroduction of unexpanded macros into the AST without
48 // changing the implementation at all. This relies on some external mechanism, that be the
49 // Wave preprocessor or some other, to find the preprocessor directives and the unexpanded
50 // macros.
51 void attachPreprocessingInfo(SgSourceFile *sageFile, std::map<std::string,ROSEAttributesList*>*);
52 #endif
53 
54 #endif
55 
56 // EOF