diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-09-25 17:18:14 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-09-25 17:18:14 +0000 |
commit | 4d7e0ced7f16a04aabe2d8d91cbbb52fb1162810 (patch) | |
tree | c6aa5f04eb7a64fb940e2be0a6eeb6afff3465d5 /include/clang/Basic/IdentifierTable.h | |
parent | 317d8f339c2ee7b59e0e8cc81646ef664e20532d (diff) |
Macro history (de-)serialization. Deserialization currently reads only the latest macro definition. Needs more work.
Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules.
Reviewers: doug.gregor
Reviewed By: alexfh
CC: cfe-commits, rsmith
Differential Revision: http://llvm-reviews.chandlerc.com/D41
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164610 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index e0f4510f26..b3b1842aad 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -54,6 +54,7 @@ class IdentifierInfo { // are for builtins. unsigned ObjCOrBuiltinID :11; bool HasMacro : 1; // True if there is a #define for this. + bool HadMacro : 1; // True if there was a #define for this. bool IsExtension : 1; // True if identifier is a lang extension. bool IsCXX11CompatKeyword : 1; // True if identifier is a keyword in C++11. bool IsPoisoned : 1; // True if identifier is poisoned. @@ -70,8 +71,8 @@ class IdentifierInfo { // stored externally. bool IsModulesImport : 1; // True if this is the 'import' contextual // keyword. - // 1 bit left in 32-bit word. - + // 32-bit word is filled. + void *FETokenInfo; // Managed by the language front-end. llvm::StringMapEntry<IdentifierInfo*> *Entry; @@ -133,10 +134,18 @@ public: if (HasMacro == Val) return; HasMacro = Val; - if (Val) + if (Val) { NeedsHandleIdentifier = 1; - else + HadMacro = true; + } else { RecomputeNeedsHandleIdentifier(); + } + } + /// \brief Returns true if this identifier was \#defined to some value at any + /// moment. In this case there should be an entry for the identifier in the + /// macro history table in Preprocessor. + bool hadMacroDefinition() const { + return HadMacro; } /// getTokenID - If this is a source-language token (e.g. 'for'), this API |