r174182 - Fixed segmentation fault when a CFGBlock has NULL successor.
Alexander Kornienko
alexfh at google.com
Fri Feb 1 07:39:20 PST 2013
Author: alexfh
Date: Fri Feb 1 09:39:20 2013
New Revision: 174182
URL: http://llvm.org/viewvc/llvm-project?rev=174182&view=rev
Log:
Fixed segmentation fault when a CFGBlock has NULL successor.
Modified:
cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=174182&r1=174181&r2=174182&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Fri Feb 1 09:39:20 2013
@@ -714,7 +714,7 @@ namespace {
for (CFGBlock::const_succ_iterator I = P->succ_begin(),
E = P->succ_end();
I != E; ++I) {
- if (ReachableBlocks.insert(*I))
+ if (*I && ReachableBlocks.insert(*I))
BlockQueue.push_back(*I);
}
}
Modified: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp?rev=174182&r1=174181&r2=174182&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp (original)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp Fri Feb 1 09:39:20 2013
@@ -172,6 +172,11 @@ int fallthrough_macro1(int n) {
return n;
}
+void fallthrough_cfgblock_with_null_successor(int x) {
+ (x && "") ? (void)(0) : (void)(1);
+ switch (x) {}
+}
+
int fallthrough_position(int n) {
switch (n) {
[[clang::fallthrough]]; // expected-warning{{fallthrough annotation in unreachable code}}
More information about the cfe-commits
mailing list