r235570 - [modules] Actually allocate the extra space we use for the tail-allocated array
Richard Smith
richard-llvm at metafoo.co.uk
Wed Apr 22 21:13:53 PDT 2015
Author: rsmith
Date: Wed Apr 22 23:13:52 2015
New Revision: 235570
URL: http://llvm.org/viewvc/llvm-project?rev=235570&view=rev
Log:
[modules] Actually allocate the extra space we use for the tail-allocated array
in this class.
Modified:
cfe/trunk/lib/Lex/MacroInfo.cpp
Modified: cfe/trunk/lib/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroInfo.cpp?rev=235570&r1=235569&r2=235570&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/MacroInfo.cpp (original)
+++ cfe/trunk/lib/Lex/MacroInfo.cpp Wed Apr 22 23:13:52 2015
@@ -237,7 +237,9 @@ void MacroDirective::dump() const {
ModuleMacro *ModuleMacro::create(Preprocessor &PP, unsigned OwningModuleID,
IdentifierInfo *II, MacroInfo *Macro,
- ArrayRef<ModuleMacro*> Overrides) {
- return new (PP.getPreprocessorAllocator())
- ModuleMacro(OwningModuleID, II, Macro, Overrides);
+ ArrayRef<ModuleMacro *> Overrides) {
+ void *Mem = PP.getPreprocessorAllocator().Allocate(
+ sizeof(ModuleMacro) + sizeof(ModuleMacro *) * Overrides.size(),
+ llvm::alignOf<ModuleMacro>());
+ return new (Mem) ModuleMacro(OwningModuleID, II, Macro, Overrides);
}
More information about the cfe-commits
mailing list