summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeLesley Hutchins <delesley@google.com>2015-04-15 22:32:44 +0000
committerDeLesley Hutchins <delesley@google.com>2015-04-15 22:32:44 +0000
commit773ba375293d39cd60ee5e00aad8e5cf38667ae3 (patch)
treec99b3df3fc67f9f55c1d95ea7c18e5c715c80081
parent62e0f454a03d4989c1646563ba2e8d87c5753964 (diff)
downloadbcm5719-llvm-773ba375293d39cd60ee5e00aad8e5cf38667ae3.tar.gz
bcm5719-llvm-773ba375293d39cd60ee5e00aad8e5cf38667ae3.zip
Fix for PR20402 in -Wconsumed.
https://llvm.org/bugs/show_bug.cgi?id=20402 Patch by Chris Wailes. llvm-svn: 235051
-rw-r--r--clang/lib/Analysis/Consumed.cpp2
-rw-r--r--clang/test/SemaCXX/warn-consumed-analysis.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Analysis/Consumed.cpp b/clang/lib/Analysis/Consumed.cpp
index 967f3e1dbfb..fa985ee02e5 100644
--- a/clang/lib/Analysis/Consumed.cpp
+++ b/clang/lib/Analysis/Consumed.cpp
@@ -1442,7 +1442,7 @@ void ConsumedAnalyzer::run(AnalysisDeclContext &AC) {
CurrStates,
WarningsHandler);
- if (BlockInfo.allBackEdgesVisited(*SI, CurrBlock))
+ if (BlockInfo.allBackEdgesVisited(CurrBlock, *SI))
BlockInfo.discardInfo(*SI);
} else {
BlockInfo.addInfo(*SI, CurrStates, OwnershipTaken);
diff --git a/clang/test/SemaCXX/warn-consumed-analysis.cpp b/clang/test/SemaCXX/warn-consumed-analysis.cpp
index 977b862a92b..0a6aed61862 100644
--- a/clang/test/SemaCXX/warn-consumed-analysis.cpp
+++ b/clang/test/SemaCXX/warn-consumed-analysis.cpp
@@ -638,6 +638,18 @@ void testWhileLoop1() {
*var0; // expected-warning {{invalid invocation of method 'operator*' on object 'var0' while it is in the 'consumed' state}}
}
+// Tests if state information is correctly discarded for certain shapes of CFGs.
+void testSwitchGOTO(void) {
+ int a;
+
+ LABEL0:
+ switch (a)
+ case 0:
+ goto LABEL0;
+
+ goto LABEL0;
+}
+
typedef const int*& IntegerPointerReference;
void testIsRValueRefishAndCanonicalType(IntegerPointerReference a) {}
OpenPOWER on IntegriCloud