r219539 - [modules] Delay loading the field declared with an anonymous tag declaration
Richard Smith
richard-llvm at metafoo.co.uk
Fri Oct 10 15:37:41 PDT 2014
Author: rsmith
Date: Fri Oct 10 17:37:41 2014
New Revision: 219539
URL: http://llvm.org/viewvc/llvm-project?rev=219539&view=rev
Log:
[modules] Delay loading the field declared with an anonymous tag declaration
until after we've had a chance to merge that tag.
Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
cfe/trunk/test/Modules/Inputs/cxx-templates-c.h
cfe/trunk/test/Modules/cxx-templates.cpp
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=219539&r1=219538&r2=219539&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Oct 10 17:37:41 2014
@@ -535,7 +535,7 @@ ASTDeclReader::RedeclarableResult ASTDec
TypedefNameForLinkage = Reader.GetIdentifierInfo(F, Record, Idx);
break;
case 3: // DeclaratorForAnonDecl
- TD->NamedDeclOrQualifier = ReadDeclAs<NamedDecl>(Record, Idx);
+ NamedDeclForTagDecl = ReadDeclID(Record, Idx);
break;
default:
llvm_unreachable("unexpected tag info kind");
Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-a.h?rev=219539&r1=219538&r2=219539&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-a.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-a.h Fri Oct 10 17:37:41 2014
@@ -89,3 +89,11 @@ typedef PartiallyInstantiatePartialSpec<
void InstantiateWithAliasTemplate(WithAliasTemplate<int>::X<char>);
inline int InstantiateWithAnonymousDeclsA(WithAnonymousDecls<int> x) { return (x.k ? x.a : x.b) + (x.k ? x.s.c : x.s.d) + x.e; }
inline int InstantiateWithAnonymousDeclsB2(WithAnonymousDecls<char> x);
+
+
+template<typename T1 = int>
+struct MergeAnonUnionMember {
+ MergeAnonUnionMember() { (void)values.t1; }
+ union { int t1; } values;
+};
+inline MergeAnonUnionMember<> maum_a() { return {}; }
Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-c.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-c.h?rev=219539&r1=219538&r2=219539&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-c.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-c.h Fri Oct 10 17:37:41 2014
@@ -11,3 +11,10 @@ template<typename T> struct MergeTemplat
static constexpr int g();
};
template<typename T> constexpr int MergeTemplateDefinitions<T>::g() { return 2; }
+
+template<typename T1 = int>
+struct MergeAnonUnionMember {
+ MergeAnonUnionMember() { (void)values.t1; }
+ union { int t1; } values;
+};
+inline MergeAnonUnionMember<> maum_c() { return {}; }
Modified: cfe/trunk/test/Modules/cxx-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=219539&r1=219538&r2=219539&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)
+++ cfe/trunk/test/Modules/cxx-templates.cpp Fri Oct 10 17:37:41 2014
@@ -144,6 +144,8 @@ MergeSpecializations<double>::explicitly
MergeSpecializations<bool>::explicitly_specialized_in_c spec_in_c_2;
#endif
+MergeAnonUnionMember<> maum_main;
+
using AliasTemplateMergingTest = WithAliasTemplate<int>::X<char>;
int AnonymousDeclsMergingTest(WithAnonymousDecls<int> WAD, WithAnonymousDecls<char> WADC) {
More information about the cfe-commits
mailing list