Skip to content

Commit a77b66a

Browse files
committed
Allocate builtins table earlier to fix bug found by ubsan
Follow up to 979da9a
1 parent b4e2b11 commit a77b66a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Lex/Preprocessor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
113113
// We haven't read anything from the external source.
114114
ReadMacrosFromExternalSource = false;
115115

116+
BuiltinInfo = std::make_unique<Builtin::Context>();
117+
116118
// "Poison" __VA_ARGS__, __VA_OPT__ which can only appear in the expansion of
117119
// a macro. They get unpoisoned where it is allowed.
118120
(Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
@@ -203,7 +205,6 @@ void Preprocessor::Initialize(const TargetInfo &Target,
203205
this->AuxTarget = AuxTarget;
204206

205207
// Initialize information about built-ins.
206-
BuiltinInfo = std::make_unique<Builtin::Context>();
207208
BuiltinInfo->InitializeTarget(Target, AuxTarget);
208209
HeaderInfo.setTarget(Target);
209210

0 commit comments

Comments
 (0)