summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-05-24 20:41:31 +0000
committerTed Kremenek <kremenek@apple.com>2011-05-24 20:41:31 +0000
commit3a601140852338af4398315419f7d060025dfb2c (patch)
treeadc6746a80529583272400b3b75b21c5c9427407 /clang/lib/Analysis/CFG.cpp
parentc731848a05562ea1b246702f6c96ece875ce3ad4 (diff)
downloadbcm5719-llvm-3a601140852338af4398315419f7d060025dfb2c.tar.gz
bcm5719-llvm-3a601140852338af4398315419f7d060025dfb2c.zip
Add explicit CFG support for ignoring static_asserts.
llvm-svn: 132001
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r--clang/lib/Analysis/CFG.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index f1201913d0c..621adb3e51c 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud