diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-18 01:16:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-18 01:16:55 +0000 |
commit | 40fb0b9d860602604ba73e3df69ea5002ce67caa (patch) | |
tree | 1d95bc01bc063806f3e89eb1b33942e7abd5673a /include/clang/Lex/Preprocessor.h | |
parent | 2685deaab3782525ebe2dd77f851c1809ab49e56 (diff) |
PR28438: Update the information on an identifier with local definitions before
trying to write out its macro graph, in case we imported a module that added
another module macro between the most recent local definition and the end of
the module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 000df6647f..66ff490de1 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -398,6 +398,8 @@ class Preprocessor : public RefCountedBase<Preprocessor> { ModuleMacroInfo *getModuleInfo(Preprocessor &PP, const IdentifierInfo *II) const { + if (II->isOutOfDate()) + PP.updateOutOfDateIdentifier(const_cast<IdentifierInfo&>(*II)); // FIXME: Find a spare bit on IdentifierInfo and store a // HasModuleMacros flag. if (!II->hasMacroDefinition() || @@ -653,6 +655,8 @@ class Preprocessor : public RefCountedBase<Preprocessor> { }; DeserializedMacroInfoChain *DeserialMIChainHead; + void updateOutOfDateIdentifier(IdentifierInfo &II) const; + public: Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts, DiagnosticsEngine &diags, LangOptions &opts, @@ -900,6 +904,8 @@ public: /// \brief Get the list of leaf (non-overridden) module macros for a name. ArrayRef<ModuleMacro*> getLeafModuleMacros(const IdentifierInfo *II) const { + if (II->isOutOfDate()) + updateOutOfDateIdentifier(const_cast<IdentifierInfo&>(*II)); auto I = LeafModuleMacros.find(II); if (I != LeafModuleMacros.end()) return I->second; |