diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-19 03:48:30 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-19 03:48:30 +0000 |
| commit | cd45dbc5f24c2f764c9c3435b7b31e74d6faac15 (patch) | |
| tree | 79b2fcb05255ccfc49630aae44b8700c3ce59f27 /clang/lib/Sema | |
| parent | af90cf528c32265ecc6888714a28ef3e97342802 (diff) | |
| download | bcm5719-llvm-cd45dbc5f24c2f764c9c3435b7b31e74d6faac15.tar.gz bcm5719-llvm-cd45dbc5f24c2f764c9c3435b7b31e74d6faac15.zip | |
When a module completes the definition of a class template specialization imported from another module, emit an update record, rather than using the broken decl rewriting mechanism. If multiple modules do this, merge the definitions together, much as we would if they were separate declarations.
llvm-svn: 206680
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 8f00f922110..96c63601148 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -3440,7 +3440,8 @@ static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info, return false; // Overwhelmingly common case: we have a direct initializer for this field. - if (CXXCtorInitializer *Init = Info.AllBaseFields.lookup(Field)) + if (CXXCtorInitializer *Init = + Info.AllBaseFields.lookup(Field->getCanonicalDecl())) return Info.addFieldInitializer(Init); // C++11 [class.base.init]p8: @@ -3553,7 +3554,7 @@ bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, if (Member->isBaseInitializer()) Info.AllBaseFields[Member->getBaseClass()->getAs<RecordType>()] = Member; else { - Info.AllBaseFields[Member->getAnyMember()] = Member; + Info.AllBaseFields[Member->getAnyMember()->getCanonicalDecl()] = Member; if (IndirectFieldDecl *F = Member->getIndirectMember()) { for (auto *C : F->chain()) { @@ -3701,7 +3702,7 @@ static void PopulateKeysForFields(FieldDecl *Field, SmallVectorImpl<const void*> return; } } - IdealInits.push_back(Field); + IdealInits.push_back(Field->getCanonicalDecl()); } static const void *GetKeyForBase(ASTContext &Context, QualType BaseType) { @@ -3713,7 +3714,7 @@ static const void *GetKeyForMember(ASTContext &Context, if (!Member->isAnyMemberInitializer()) return GetKeyForBase(Context, QualType(Member->getBaseClass(), 0)); - return Member->getAnyMember(); + return Member->getAnyMember()->getCanonicalDecl(); } static void DiagnoseBaseOrMemInitializerOrder( @@ -3908,13 +3909,12 @@ void Sema::ActOnMemInitializers(Decl *ConstructorDecl, Init->setSourceOrder(i); if (Init->isAnyMemberInitializer()) { - FieldDecl *Field = Init->getAnyMember(); - if (CheckRedundantInit(*this, Init, Members[Field]) || + const void *Key = GetKeyForMember(Context, Init); + if (CheckRedundantInit(*this, Init, Members[Key]) || CheckRedundantUnionInit(*this, Init, MemberUnions)) HadError = true; } else if (Init->isBaseInitializer()) { - const void *Key = - GetKeyForBase(Context, QualType(Init->getBaseClass(), 0)); + const void *Key = GetKeyForMember(Context, Init); if (CheckRedundantInit(*this, Init, Members[Key])) HadError = true; } else { |

