forked from OSchip/llvm-project
Fix two embarrassing PCH bugs:
1) Accidentally used delete [] on an array of statements that was allocated with ASTContext's allocator 2) Deserialization of names with multiple declarations (e.g., a struct and a function) used the wrong mangling constant, causing it to view declaration IDs as Decl*s. 403.gcc builds and links properly. llvm-svn: 69390
This commit is contained in:
parent
12f0dea922
commit
ba6e557378
|
@ -101,7 +101,7 @@ public:
|
|||
VectorTy *Vector = getAsVector();
|
||||
if (!Vector) {
|
||||
Vector = new VectorTy;
|
||||
Data = reinterpret_cast<uintptr_t>(Vector) | DK_Decl_Vector;
|
||||
Data = reinterpret_cast<uintptr_t>(Vector) | DK_ID_Vector;
|
||||
}
|
||||
|
||||
Vector->resize(Vec.size());
|
||||
|
|
|
@ -222,7 +222,7 @@ void CallExpr::setNumArgs(ASTContext& C, unsigned NumArgs) {
|
|||
for (unsigned i = getNumArgs()+ARGS_START; i != NumArgs+ARGS_START; ++i)
|
||||
NewSubExprs[i] = 0;
|
||||
|
||||
delete [] SubExprs;
|
||||
if (SubExprs) C.Deallocate(SubExprs);
|
||||
SubExprs = NewSubExprs;
|
||||
this->NumArgs = NumArgs;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// Test this without pch.
|
||||
// RUN: clang-cc -include %S/multiple_decls.h -fsyntax-only -ast-print -o - %s
|
||||
|
||||
// Test with pch.
|
||||
// RUN: clang-cc -emit-pch -o %t %S/multiple_decls.h &&
|
||||
// RUN: clang-cc -include-pch %t -fsyntax-only -ast-print -o - %s
|
||||
|
||||
void f0(char c) {
|
||||
wide(c);
|
||||
}
|
||||
|
||||
struct wide w;
|
||||
struct narrow n;
|
||||
|
||||
void f1(int i) {
|
||||
narrow(i);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// Header for PCH test multiple_decls.c
|
||||
|
||||
struct wide { int value; };
|
||||
int wide(char);
|
||||
|
||||
struct narrow { char narrow; };
|
||||
char narrow(int);
|
Loading…
Reference in New Issue