summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-11-18 10:37:54 -0800
committerReid Kleckner <rnk@google.com>2019-11-18 10:41:30 -0800
commita77b66a05625ea4271c2d76f65428cce02e4699e (patch)
tree205ed7e7d55a6c1ac4ad27bdb501ac04b0e9a19f /clang/lib/Lex/Preprocessor.cpp
parentb4e2b112b58154a89171df39dae80044865ff4ff (diff)
downloadbcm5719-llvm-a77b66a05625ea4271c2d76f65428cce02e4699e.tar.gz
bcm5719-llvm-a77b66a05625ea4271c2d76f65428cce02e4699e.zip
Allocate builtins table earlier to fix bug found by ubsan
Follow up to 979da9a4c3ba
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 496eae980c0..0e9be392363 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);
OpenPOWER on IntegriCloud