forked from OSchip/llvm-project
Teach -Wuninitialized to not warn about variables declared in C++ catch statements.
llvm-svn: 129102
This commit is contained in:
parent
27f3330132
commit
97c393807b
|
@ -27,6 +27,7 @@ using namespace clang;
|
|||
|
||||
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();
|
||||
|
|
|
@ -78,3 +78,17 @@ void PR9625() {
|
|||
(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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue