DeadStoresChecker: Don't warn about dead stores into volatile variables

llvm-svn: 273689
This commit is contained in:
Stephan Bergmann 2016-06-24 16:26:43 +00:00
parent 9f7f3e1e64
commit bf95fff9bd
2 changed files with 6 additions and 0 deletions

View File

@ -278,6 +278,8 @@ public:
RHS = RHS->IgnoreParenCasts();
QualType T = VD->getType();
if (T.isVolatileQualified())
return;
if (T->isPointerType() || T->isObjCObjectPointerType()) {
if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull))
return;

View File

@ -569,3 +569,7 @@ void testBOComma() {
}
void testVolatile() {
volatile int v;
v = 0; // no warning
}