diff options
author | Vedant Kumar <vsk@apple.com> | 2017-04-26 15:40:21 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-04-26 15:40:21 +0000 |
commit | 25b6a7db2fa59eacca01da41b1c9521b0da74fc4 (patch) | |
tree | e7ece74b579f2e405686d707e80408f3c4320ef7 /clang/lib/Sema/SemaDecl.cpp | |
parent | 7f5b3d6fc83e4f4c2aa64967ba9f45a361b67502 (diff) | |
download | bcm5719-llvm-25b6a7db2fa59eacca01da41b1c9521b0da74fc4.tar.gz bcm5719-llvm-25b6a7db2fa59eacca01da41b1c9521b0da74fc4.zip |
[Sema] Avoid using a null type pointer (fixes PR32750)
isMicrosoftMissingTypename() uses a Type pointer without first checking
that it's non-null. PR32750 reports a case where the pointer is in fact
null. This patch adds in a defensive check and a regression test.
Differential Revision: https://reviews.llvm.org/D32519
llvm-svn: 301420
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e7ea68e8e69..f838c9a4877 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -615,7 +615,7 @@ bool Sema::isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S) { CXXRecordDecl *RD = cast<CXXRecordDecl>(CurContext); for (const auto &Base : RD->bases()) - if (Context.hasSameUnqualifiedType(QualType(Ty, 1), Base.getType())) + if (Ty && Context.hasSameUnqualifiedType(QualType(Ty, 1), Base.getType())) return true; return S->isFunctionPrototypeScope(); } |