diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-05-24 20:41:31 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-05-24 20:41:31 +0000 |
commit | 29c9e62f412c9db3ee238db2472390685a6303f3 (patch) | |
tree | 186b7902188b4f4e7e3844041ce29bc155075813 /lib/Analysis/CFG.cpp | |
parent | 776bff74a63b3ebf52b0a7cf9af878c108031208 (diff) |
Add explicit CFG support for ignoring static_asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index f1201913d0..621adb3e51 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -1323,6 +1323,7 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) { if (isa<LabelDecl>(*DS->decl_begin())) return Block; + // This case also handles static_asserts. if (DS->isSingleDecl()) return VisitDeclSubExpr(DS); @@ -1355,7 +1356,14 @@ 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) { |