r230716 - [modules] For an inheriting constructor, the inherited constructor is stored in

Richard Smith richard-llvm at metafoo.co.uk
Thu Feb 26 17:57:00 PST 2015


Author: rsmith
Date: Thu Feb 26 19:57:00 2015
New Revision: 230716

URL: http://llvm.org/viewvc/llvm-project?rev=230716&view=rev
Log:
[modules] For an inheriting constructor, the inherited constructor is stored in
a map keyed off the canonical declaration. Don't try to set it if we're loading
some non-canonical merged declaration.

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
    cfe/trunk/test/Modules/Inputs/cxx-decls-merged.h
    cfe/trunk/test/Modules/cxx-decls.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=230716&r1=230715&r2=230716&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Feb 26 19:57:00 2015
@@ -1611,7 +1611,8 @@ void ASTDeclReader::VisitCXXConstructorD
   VisitCXXMethodDecl(D);
 
   if (auto *CD = ReadDeclAs<CXXConstructorDecl>(Record, Idx))
-    D->setInheritedConstructor(CD);
+    if (D->isCanonicalDecl())
+      D->setInheritedConstructor(CD);
   D->IsExplicitSpecified = Record[Idx++];
   // FIXME: We should defer loading this until we need the constructor's body.
   std::tie(D->CtorInitializers, D->NumCtorInitializers) =

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=230716&r1=230715&r2=230716&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h Thu Feb 26 19:57:00 2015
@@ -47,3 +47,6 @@ typedef decltype(name_for_linkage2_inner
 
 namespace Aliased { extern int a; }
 namespace Alias = Aliased;
+
+struct InhCtorA { InhCtorA(int); };
+struct InhCtorB : InhCtorA { using InhCtorA::InhCtorA; };

Modified: cfe/trunk/test/Modules/Inputs/cxx-decls-merged.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-decls-merged.h?rev=230716&r1=230715&r2=230716&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-decls-merged.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-decls-merged.h Thu Feb 26 19:57:00 2015
@@ -25,3 +25,6 @@ typedef decltype(name_for_linkage2_inner
 
 namespace Aliased { extern int b; }
 namespace Alias = Aliased;
+
+struct InhCtorA { InhCtorA(int); };
+struct InhCtorB : InhCtorA { using InhCtorA::InhCtorA; };

Modified: cfe/trunk/test/Modules/cxx-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-decls.cpp?rev=230716&r1=230715&r2=230716&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-decls.cpp (original)
+++ cfe/trunk/test/Modules/cxx-decls.cpp Thu Feb 26 19:57:00 2015
@@ -52,5 +52,7 @@ int use_namespace_alias() { return Alias
 
 void use_extern_c_function_2() { ExternCFunction(); }
 
+InhCtorB inhctorb(2);
+
 // CHECK: VarDecl [[mergeUsedFlag:0x[0-9a-f]*]] {{.*}} in cxx_decls.imported used mergeUsedFlag
 // CHECK: VarDecl {{0x[0-9a-f]*}} prev [[mergeUsedFlag]] {{.*}} in cxx_decls_merged used mergeUsedFlag





More information about the cfe-commits mailing list