[cfe-commits] r131141 - in /cfe/trunk: lib/Analysis/CFG.cpp test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Tue May 10 11:42:15 PDT 2011
Author: kremenek
Date: Tue May 10 13:42:15 2011
New Revision: 131141
URL: http://llvm.org/viewvc/llvm-project?rev=131141&view=rev
Log:
Elide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVisitor (crash in static analyzer).
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=131141&r1=131140&r2=131141&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Tue May 10 13:42:15 2011
@@ -1314,6 +1314,11 @@
}
CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) {
+ // Check if the Decl is for an __label__. If so, elide it from the
+ // CFG entirely.
+ if (isa<LabelDecl>(*DS->decl_begin()))
+ return Block;
+
if (DS->isSingleDecl())
return VisitDeclSubExpr(DS);
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=131141&r1=131140&r2=131141&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Tue May 10 13:42:15 2011
@@ -1301,3 +1301,14 @@
}
}
}
+
+// Don't crash on code containing __label__.
+int radar9414427_aux();
+void radar9414427() {
+ __label__ mylabel;
+ if (radar9414427_aux()) {
+ mylabel: do {}
+ while (0);
+ }
+}
+
More information about the cfe-commits
mailing list