diff options
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateVariadic.cpp | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index f58e744578..0ad9f7c53f 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -2168,8 +2168,7 @@ bool Sema::Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, Decl *LocalInstantiationScope::getInstantiationOf(const Decl *D) { llvm::PointerUnion<Decl *, DeclArgumentPack *> *Found= findInstantiationOf(D); - if (!Found) - return 0; + assert(Found); if (Found->is<Decl *>()) return Found->get<Decl *>(); @@ -2202,8 +2201,7 @@ LocalInstantiationScope::findInstantiationOf(const Decl *D) { break; } - assert(D->isInvalidDecl() && - "declaration was not instantiated in this scope!"); + assert(0 && "declaration was not instantiated in this scope!"); return 0; } diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index a49c23b1df..0da801c7e3 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -503,8 +503,7 @@ bool Sema::CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation = CurrentInstantiationScope->findInstantiationOf( Unexpanded[I].first.get<NamedDecl *>()); - if (Instantiation && - Instantiation->is<DeclArgumentPack *>()) { + if (Instantiation->is<DeclArgumentPack *>()) { // We could expand this function parameter pack. NewPackSize = Instantiation->get<DeclArgumentPack *>()->size(); } else { @@ -594,7 +593,7 @@ unsigned Sema::getNumArgumentsInExpansion(QualType T, llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation = CurrentInstantiationScope->findInstantiationOf( Unexpanded[I].first.get<NamedDecl *>()); - if (Instantiation && Instantiation->is<DeclArgumentPack *>()) + if (Instantiation->is<DeclArgumentPack *>()) return Instantiation->get<DeclArgumentPack *>()->size(); continue; |