diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-19 02:19:21 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-19 02:19:21 +0000 |
commit | eb86173f7bfe9f794c59c8a996f41f19a839963a (patch) | |
tree | ad437f5eab150f44a85d9391905b935d529803aa /clang/lib/AST/Decl.cpp | |
parent | 2662e56d25cd83ebc9fc8f297f6a2a337c03e601 (diff) | |
download | bcm5719-llvm-eb86173f7bfe9f794c59c8a996f41f19a839963a.tar.gz bcm5719-llvm-eb86173f7bfe9f794c59c8a996f41f19a839963a.zip |
Fix member function call with null 'this' pointer.
llvm-svn: 300653
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 9b5ba813dbd..5fe07065212 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2253,6 +2253,7 @@ bool VarDecl::checkInitIsICE() const { template<typename DeclT> static DeclT *getDefinitionOrSelf(DeclT *D) { + assert(D); if (auto *Def = D->getDefinition()) return Def; return D; @@ -3202,9 +3203,12 @@ bool FunctionDecl::isTemplateInstantiation() const { FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { // Handle class scope explicit specialization special case. - if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) - return getDefinitionOrSelf(getClassScopeSpecializationPattern()); - + if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { + if (auto *Spec = getClassScopeSpecializationPattern()) + return getDefinitionOrSelf(Spec); + return nullptr; + } + // If this is a generic lambda call operator specialization, its // instantiation pattern is always its primary template's pattern // even if its primary template was instantiated from another |