diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2013-06-03 22:59:41 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2013-06-03 22:59:41 +0000 |
| commit | 5250b873bb12716e60818f5a97aa6df824760af3 (patch) | |
| tree | ef81afa277687230c7e3d755e70a85f7b2d9d15c /clang/lib/Analysis/CFG.cpp | |
| parent | 1d1592624c73b83723f93867c459e71afc6e9aed (diff) | |
| download | bcm5719-llvm-5250b873bb12716e60818f5a97aa6df824760af3.tar.gz bcm5719-llvm-5250b873bb12716e60818f5a97aa6df824760af3.zip | |
CFG: In a DeclStmt, skip anything that's not a VarDecl.
Neither the compiler nor the analyzer are doing anything with non-VarDecl
decls in the CFG, and having them there creates extra nodes in the
analyzer's path diagnostics. Simplify the CFG (and the path edges) by
simply leaving them out. We can always add interesting decls back in when
they become relevant.
Note that this only affects decls declared in a DeclStmt, and then only
those that appear within a function body.
llvm-svn: 183157
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
| -rw-r--r-- | clang/lib/Analysis/CFG.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 674c01201d2..e06e6617508 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1639,19 +1639,11 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) { /// DeclStmts and initializers in them. CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt *DS) { assert(DS->isSingleDecl() && "Can handle single declarations only."); - Decl *D = DS->getSingleDecl(); - - if (isa<StaticAssertDecl>(D)) { - // static_asserts aren't added to the CFG because they do not impact - // runtime semantics. - return Block; - } - VarDecl *VD = dyn_cast<VarDecl>(DS->getSingleDecl()); if (!VD) { - autoCreateBlock(); - appendStmt(Block, DS); + // Of everything that can be declared in a DeclStmt, only VarDecls impact + // runtime semantics. return Block; } |

