Push implicitly-declared allocation functions into the IdResolver. Otherwise,

declaration merging in modules is unable to find them and we get bogus errors
and even crashes.

llvm-svn: 208944
This commit is contained in:
Richard Smith 2014-05-16 02:14:42 +00:00
parent ee390436b9
commit debcd500a0
3 changed files with 7 additions and 3 deletions

View File

@ -2109,10 +2109,8 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
}
Alloc->setParams(ArrayRef<ParmVarDecl*>(ParamDecls, NumParams));
// FIXME: Also add this declaration to the IdentifierResolver, but
// make sure it is at the end of the chain to coincide with the
// global scope.
Context.getTranslationUnitDecl()->addDecl(Alloc);
IdResolver.tryAddTopLevelDecl(Alloc, Name);
}
FunctionDecl *Sema::FindUsualDeallocationFunction(SourceLocation StartLoc,

View File

@ -18,3 +18,5 @@ private:
static_assert(!__is_trivial(HasNontrivialDefaultConstructor), "");
static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), "");
void *operator new[](__SIZE_TYPE__);

View File

@ -3,6 +3,8 @@
// expected-no-diagnostics
void use_implicit_new() { operator new[](3); }
@import dummy;
@import cxx_decls.imported;
@ -22,3 +24,5 @@ void test_friends(HasFriends s) {
static_assert(!__is_trivial(HasNontrivialDefaultConstructor), "");
static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), "");
void use_implicit_new_again() { operator new[](3); }