summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-16 01:33:16 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-16 01:33:16 +0000
commit9ed04aa7acc6c6be01bd609a6f40b43d094b88a2 (patch)
treea7505a1eaf4b67c7679e0f8f9de5e4b9a8210826
parent925c9b499e0af712975f5a3d4dd6a429c254a2d8 (diff)
downloadbcm5719-llvm-9ed04aa7acc6c6be01bd609a6f40b43d094b88a2.tar.gz
bcm5719-llvm-9ed04aa7acc6c6be01bd609a6f40b43d094b88a2.zip
libAnalysis: Add a case for TypeAliasDecl in CFGRecStmtDeclVisitor.
Neither of the current clients of CFGRecStmtDeclVisitor are doing anything with typedefs, so I assume type aliases (C++11 "using") can be safely ignored. This was causing assertion failures in the analyzer. <rdar://problem/13228440> llvm-svn: 175335
-rw-r--r--clang/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h2
-rw-r--r--clang/test/Analysis/dead-stores.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h b/clang/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
index dd6de6e548d..2bf3eda070b 100644
--- a/clang/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
+++ b/clang/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
@@ -63,6 +63,7 @@ public:
DISPATCH_CASE(ImplicitParam)
DISPATCH_CASE(EnumConstant)
DISPATCH_CASE(Typedef)
+ DISPATCH_CASE(TypeAlias)
DISPATCH_CASE(Record) // FIXME: Refine. VisitStructDecl?
DISPATCH_CASE(CXXRecord)
DISPATCH_CASE(Enum)
@@ -82,6 +83,7 @@ public:
DEFAULT_DISPATCH(ImplicitParam)
DEFAULT_DISPATCH(EnumConstant)
DEFAULT_DISPATCH(Typedef)
+ DEFAULT_DISPATCH(TypeAlias)
DEFAULT_DISPATCH(Record)
DEFAULT_DISPATCH(Enum)
DEFAULT_DISPATCH(Field)
diff --git a/clang/test/Analysis/dead-stores.cpp b/clang/test/Analysis/dead-stores.cpp
index 86d84f0fbfa..e1a034b1d02 100644
--- a/clang/test/Analysis/dead-stores.cpp
+++ b/clang/test/Analysis/dead-stores.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=region -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -analyze -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -analyze -analyzer-store=region -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
//===----------------------------------------------------------------------===//
// Basic dead store checking (but in C++ mode).
@@ -149,3 +149,10 @@ void test_6b() {
}
catch (void *) {}
}
+
+
+void testCXX11Using() {
+ using Int = int;
+ Int value;
+ value = 1; // expected-warning {{never read}}
+}
OpenPOWER on IntegriCloud