summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PreprocessingRecord.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-19 17:12:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-19 17:12:43 +0000
commit7dc8722bd399e20995a3c808d50c39450cf6807a (patch)
treea6ac46c9397a666af980868f58405a640d64f38a /clang/lib/Lex/PreprocessingRecord.cpp
parent7f6d60dcc2cea9975c125fe6750ecc39af6a6fb0 (diff)
downloadbcm5719-llvm-7dc8722bd399e20995a3c808d50c39450cf6807a.tar.gz
bcm5719-llvm-7dc8722bd399e20995a3c808d50c39450cf6807a.zip
Make the preprocessing record a PPCallbacks subclass itself,
eliminating the extra PopulatePreprocessingRecord object. This will become useful once we start writing the preprocessing record to precompiled headers. llvm-svn: 98966
Diffstat (limited to 'clang/lib/Lex/PreprocessingRecord.cpp')
-rw-r--r--clang/lib/Lex/PreprocessingRecord.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp
index 83268e0134a..6e0e28a1b85 100644
--- a/clang/lib/Lex/PreprocessingRecord.cpp
+++ b/clang/lib/Lex/PreprocessingRecord.cpp
@@ -21,3 +21,27 @@ void PreprocessingRecord::addPreprocessedEntity(PreprocessedEntity *Entity) {
PreprocessedEntities.push_back(Entity);
}
+MacroDefinition *PreprocessingRecord::findMacroDefinition(MacroInfo *MI) {
+ llvm::DenseMap<const MacroInfo *, MacroDefinition *>::iterator Pos
+ = MacroDefinitions.find(MI);
+ if (Pos == MacroDefinitions.end())
+ return 0;
+
+ return Pos->second;
+}
+
+void PreprocessingRecord::MacroExpands(const Token &Id, const MacroInfo* MI) {
+ PreprocessedEntities.push_back(
+ new (*this) MacroInstantiation(Id.getIdentifierInfo(),
+ Id.getLocation(),
+ MacroDefinitions[MI]));
+}
+
+void PreprocessingRecord::MacroDefined(const IdentifierInfo *II,
+ const MacroInfo *MI) {
+ SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc());
+ MacroDefinition *Def
+ = new (*this) MacroDefinition(II, MI->getDefinitionLoc(), R);
+ MacroDefinitions[MI] = Def;
+ PreprocessedEntities.push_back(Def);
+}
OpenPOWER on IntegriCloud