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 | 3a601140852338af4398315419f7d060025dfb2c (patch) | |
tree | adc6746a80529583272400b3b75b21c5c9427407 /clang/lib/Analysis/CFG.cpp | |
parent | c731848a05562ea1b246702f6c96ece875ce3ad4 (diff) | |
download | bcm5719-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.cpp | 10 |
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) { |