r208944 - Push implicitly-declared allocation functions into the IdResolver. Otherwise,
Richard Smith
richard-llvm at metafoo.co.uk
Thu May 15 19:14:42 PDT 2014
Author: rsmith
Date: Thu May 15 21:14:42 2014
New Revision: 208944
URL: http://llvm.org/viewvc/llvm-project?rev=208944&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
cfe/trunk/test/Modules/cxx-decls.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=208944&r1=208943&r2=208944&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu May 15 21:14:42 2014
@@ -2109,10 +2109,8 @@ void Sema::DeclareGlobalAllocationFuncti
}
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,
Modified: cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h?rev=208944&r1=208943&r2=208944&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h Thu May 15 21:14:42 2014
@@ -18,3 +18,5 @@ private:
static_assert(!__is_trivial(HasNontrivialDefaultConstructor), "");
static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), "");
+
+void *operator new[](__SIZE_TYPE__);
Modified: cfe/trunk/test/Modules/cxx-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-decls.cpp?rev=208944&r1=208943&r2=208944&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-decls.cpp (original)
+++ cfe/trunk/test/Modules/cxx-decls.cpp Thu May 15 21:14:42 2014
@@ -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); }
More information about the cfe-commits
mailing list