Author: Reid Kleckner Date: 2019-11-18T10:41:30-08:00 New Revision: a77b66a05625ea4271c2d76f65428cce02e4699e
URL: https://github.com/llvm/llvm-project/commit/a77b66a05625ea4271c2d76f65428cce02e4699e DIFF: https://github.com/llvm/llvm-project/commit/a77b66a05625ea4271c2d76f65428cce02e4699e.diff LOG: Allocate builtins table earlier to fix bug found by ubsan Follow up to 979da9a4c3ba Added: Modified: clang/lib/Lex/Preprocessor.cpp Removed: ################################################################################ diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 496eae980c00..0e9be3923630 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -113,6 +113,8 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts, // We haven't read anything from the external source. ReadMacrosFromExternalSource = false; + BuiltinInfo = std::make_unique<Builtin::Context>(); + // "Poison" __VA_ARGS__, __VA_OPT__ which can only appear in the expansion of // a macro. They get unpoisoned where it is allowed. (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned(); @@ -203,7 +205,6 @@ void Preprocessor::Initialize(const TargetInfo &Target, this->AuxTarget = AuxTarget; // Initialize information about built-ins. - BuiltinInfo = std::make_unique<Builtin::Context>(); BuiltinInfo->InitializeTarget(Target, AuxTarget); HeaderInfo.setTarget(Target); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits