diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-02-17 19:38:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-02-17 19:38:27 +0000 |
| commit | 15a776fff719563727876e0a99b586bf3e6a5089 (patch) | |
| tree | c47b34c1f55095c0ab8c43ed4038c64ef4a51780 /clang/lib/Sema/SemaTemplateVariadic.cpp | |
| parent | bdc1a42aef44d5ce9da8e0f20d92449ec7945593 (diff) | |
| download | bcm5719-llvm-15a776fff719563727876e0a99b586bf3e6a5089.tar.gz bcm5719-llvm-15a776fff719563727876e0a99b586bf3e6a5089.zip | |
remove some defensive code: LocalInstantiationScope::getInstantiationOf
and findInstantiationOf can never return null, even on invalid code.
llvm-svn: 125769
Diffstat (limited to 'clang/lib/Sema/SemaTemplateVariadic.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateVariadic.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index a49c23b1df8..0da801c7e34 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/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; |

