[cfe-commits] r129102 - in /cfe/trunk: lib/Analysis/UninitializedValues.cpp test/SemaCXX/uninit-variables.cpp
Ted Kremenek
kremenek at apple.com
Thu Apr 7 13:02:56 PDT 2011
Author: kremenek
Date: Thu Apr 7 15:02:56 2011
New Revision: 129102
URL: http://llvm.org/viewvc/llvm-project?rev=129102&view=rev
Log:
Teach -Wuninitialized to not warn about variables declared in C++ catch statements.
Modified:
cfe/trunk/lib/Analysis/UninitializedValues.cpp
cfe/trunk/test/SemaCXX/uninit-variables.cpp
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=129102&r1=129101&r2=129102&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Thu Apr 7 15:02:56 2011
@@ -27,6 +27,7 @@
static bool isTrackedVar(const VarDecl *vd, const DeclContext *dc) {
if (vd->isLocalVarDecl() && !vd->hasGlobalStorage() &&
+ !vd->isExceptionVariable() &&
vd->getDeclContext() == dc) {
QualType ty = vd->getType();
return ty->isScalarType() || ty->isVectorType();
Modified: cfe/trunk/test/SemaCXX/uninit-variables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/uninit-variables.cpp?rev=129102&r1=129101&r2=129102&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/uninit-variables.cpp (original)
+++ cfe/trunk/test/SemaCXX/uninit-variables.cpp Thu Apr 7 15:02:56 2011
@@ -78,3 +78,17 @@
(void)static_cast<float>(x); // no-warning
}
}
+
+// Don't warn about variables declared in "catch"
+void RDar9251392_bar(const char *msg);
+
+void RDar9251392() {
+ try {
+ throw "hi";
+ }
+ catch (const char* msg) {
+ RDar9251392_bar(msg); // no-warning
+ }
+}
+
+
More information about the cfe-commits
mailing list