[PATCH] D35181: Defer addition of keywords to identifier table when loading AST
Johann Klähn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 9 09:10:50 PDT 2017
jklaehn created this revision.
In `ASTUnit::LoadFromASTFile`, the preprocesor object is set up using
default-constructed `LangOptions` (which only later get populated).
Then, in the constructor of `IdentifierTable`, these default-constructed
`LangOptions` were used in the call to `AddKeywords`, leading to wrong
initialization of the identifier table.
This change defers adding the keywords to the identifier table until
after the language options have been loaded from the AST file.
Prior to this change the included test would fail due to the `class`
token being reported as an identifier (since the C++11 `enum class`
construct is not present when using the default language options).
https://reviews.llvm.org/D35181
Files:
include/clang/Basic/IdentifierTable.h
include/clang/Lex/Preprocessor.h
lib/Basic/IdentifierTable.cpp
lib/Frontend/ASTUnit.cpp
lib/Lex/Preprocessor.cpp
unittests/libclang/LibclangTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35181.105781.patch
Type: text/x-patch
Size: 7508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170709/f4a205ee/attachment-0001.bin>
More information about the cfe-commits
mailing list