aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/MacroInfo.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-22 21:12:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-22 21:12:51 +0000
commitbaa74bd3968028d8e5b10ee9b50d0dceb41e85a9 (patch)
tree40b17341df9746e1cc6ebc8856671e7867da10e9 /include/clang/Lex/MacroInfo.h
parenta8a0f769ff4113a7f98c232fb0fc773a65371559 (diff)
[modules] When a MacroInfo object is deserialized, allocate and store its submodule ID.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/MacroInfo.h')
-rw-r--r--include/clang/Lex/MacroInfo.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index 08052019cb..ec1385d1ea 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -101,6 +101,9 @@ private:
/// \brief Must warn if the macro is unused at the end of translation unit.
bool IsWarnIfUnused : 1;
+ /// \brief Whether this macro info was loaded from an AST file.
+ unsigned FromASTFile : 1;
+
~MacroInfo() {
assert(ArgumentList == 0 && "Didn't call destroy before dtor!");
}
@@ -272,8 +275,28 @@ public:
IsDisabled = true;
}
+ /// \brief Determine whether this macro info came from an AST file (such as
+ /// a precompiled header or module) rather than having been parsed.
+ bool isFromASTFile() const { return FromASTFile; }
+
+ /// \brief Retrieve the global ID of the module that owns this particular
+ /// macro info.
+ unsigned getOwningModuleID() const {
+ if (isFromASTFile())
+ return *(const unsigned*)(this+1);
+
+ return 0;
+ }
+
private:
unsigned getDefinitionLengthSlow(SourceManager &SM) const;
+
+ void setOwningModuleID(unsigned ID) {
+ assert(isFromASTFile());
+ *(unsigned*)(this+1) = ID;
+ }
+
+ friend class Preprocessor;
};
/// \brief Encapsulates changes to the "macros namespace" (the location where