diff options
author | Martin Bohme <mboehme@google.com> | 2017-03-07 08:42:37 +0000 |
---|---|---|
committer | Martin Bohme <mboehme@google.com> | 2017-03-07 08:42:37 +0000 |
commit | 0c11c29121a72e88d56e0a661a6954818ae40243 (patch) | |
tree | 8d67d611476a0a9dc27ddbc6136ad529dd69e30f /clang/lib/Analysis/CFG.cpp | |
parent | 8f0a62a9990ccca1deeb8090a68d4ab7b2ab51e7 (diff) | |
download | bcm5719-llvm-0c11c29121a72e88d56e0a661a6954818ae40243.tar.gz bcm5719-llvm-0c11c29121a72e88d56e0a661a6954818ae40243.zip |
[analyzer] Fix crash when building CFG with variable of incomplete type
Summary:
I've included a unit test with a function template containing a variable
of incomplete type. Clang compiles this without errors (the standard
does not require a diagnostic in this case). Without the fix, this case
triggers the crash.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D30636
llvm-svn: 297129
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index d56e0e8fa1d..2a2b3d73b5c 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1390,7 +1390,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl *VD, // Check if type is a C++ class with non-trivial destructor. if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl()) - if (!CD->hasTrivialDestructor()) { + if (CD->hasDefinition() && !CD->hasTrivialDestructor()) { // Add the variable to scope Scope = createOrReuseLocalScope(Scope); Scope->addVar(VD); |