Skip to content
Snippets Groups Projects
Commit 07509dfa authored by Stephan Bergmann's avatar Stephan Bergmann
Browse files

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273689 91177308-0d34-0410-b5e6-96231b3b80d8
parent e255c643
No related branches found
No related tags found
No related merge requests found
...@@ -278,6 +278,8 @@ public: ...@@ -278,6 +278,8 @@ public:
RHS = RHS->IgnoreParenCasts(); RHS = RHS->IgnoreParenCasts();
QualType T = VD->getType(); QualType T = VD->getType();
if (T.isVolatileQualified())
return;
if (T->isPointerType() || T->isObjCObjectPointerType()) { if (T->isPointerType() || T->isObjCObjectPointerType()) {
if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull)) if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull))
return; return;
......
...@@ -569,3 +569,7 @@ void testBOComma() { ...@@ -569,3 +569,7 @@ void testBOComma() {
} }
void testVolatile() {
volatile int v;
v = 0; // no warning
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment