Author: mrs
Date: Thu Jan 21 13:51:34 2010
New Revision: 94094
URL: http://llvm.org/viewvc/llvm-project?rev=94094&view=rev
Log:
Improve unreachable code warnings for with respect to c-style casts.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/warn-unreachable.c
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=94094&r1=94093&r2=94094&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jan 21 13:51:34 2010
@@ -2116,6 +2116,11 @@
const ConditionalOperator *CO = cast<ConditionalOperator>(S);
return CO->getQuestionLoc();
}
+ case Expr::CStyleCastExprClass: {
+ const CStyleCastExpr *CSC = cast<CStyleCastExpr>(S);
+ R1 = CSC->getSubExpr()->getSourceRange();
+ return CSC->getLParenLoc();
+ }
case Expr::ImplicitCastExprClass:
++sn;
goto top;
Modified: cfe/trunk/test/Sema/warn-unreachable.c
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-unreachable.c?rev=94094&r1=94093&r2=94094&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-unreachable.c (original)
+++ cfe/trunk/test/Sema/warn-unreachable.c Thu Jan 21 13:51:34 2010
@@ -87,5 +87,8 @@
halt()
? // expected-warning {{will never be executed}}
dead() : dead();
+ case 10:
+ ( // expected-warning {{will never be executed}}
+ float)halt();
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits