diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2018-04-16 21:07:08 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2018-04-16 21:07:08 +0000 |
commit | d742dc20d9809b36a7eec6a1f64c48755e2e5778 (patch) | |
tree | 0baae19648845980c797de4180103438c251459b /clang/lib/Basic/IdentifierTable.cpp | |
parent | 040888b6239358fa4abb495796e308d1d75c0e1d (diff) | |
download | bcm5719-llvm-d742dc20d9809b36a7eec6a1f64c48755e2e5778.tar.gz bcm5719-llvm-d742dc20d9809b36a7eec6a1f64c48755e2e5778.zip |
Defer adding keywords to the identifier table until after the language options have been loaded from the AST file.
This fixes issues with "class" being reported as an identifier in "enum class" because the construct is not present when using default language options.
Patch by Johann Klähn.
llvm-svn: 330159
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | clang/lib/Basic/IdentifierTable.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 2bed531ae3d..6b0133208ba 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -79,16 +79,16 @@ IdentifierIterator *IdentifierInfoLookup::getIdentifiers() { return new EmptyLookupIterator(); } +IdentifierTable::IdentifierTable(IdentifierInfoLookup *ExternalLookup) + : HashTable(8192), // Start with space for 8K identifiers. + ExternalLookup(ExternalLookup) {} + IdentifierTable::IdentifierTable(const LangOptions &LangOpts, - IdentifierInfoLookup* externalLookup) - : HashTable(8192), // Start with space for 8K identifiers. - ExternalLookup(externalLookup) { + IdentifierInfoLookup *ExternalLookup) + : IdentifierTable(ExternalLookup) { // Populate the identifier table with info about keywords for the current // language. AddKeywords(LangOpts); - - // Add the '_experimental_modules_import' contextual keyword. - get("import").setModulesImport(true); } //===----------------------------------------------------------------------===// @@ -237,6 +237,9 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { if (LangOpts.DeclSpecKeyword) AddKeyword("__declspec", tok::kw___declspec, KEYALL, LangOpts, *this); + + // Add the '_experimental_modules_import' contextual keyword. + get("import").setModulesImport(true); } /// \brief Checks if the specified token kind represents a keyword in the |