зеркало из https://github.com/microsoft/clang-1.git
Don't flag dead stores when the result of a preincrement/predecrement is used in an enclosing expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
5a56ac30d0
Коммит
1c61b472b2
|
@ -153,6 +153,11 @@ public:
|
||||||
if (!U->isIncrementOp())
|
if (!U->isIncrementOp())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Don't flag dead stores when the result of a preincrement/predecrement
|
||||||
|
// is used in an enclosing expression.
|
||||||
|
if (U->isPrefix() && Parents.isSubExpr(U))
|
||||||
|
return;
|
||||||
|
|
||||||
Expr *Ex = U->getSubExpr()->IgnoreParenCasts();
|
Expr *Ex = U->getSubExpr()->IgnoreParenCasts();
|
||||||
|
|
||||||
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(Ex))
|
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(Ex))
|
||||||
|
@ -161,7 +166,7 @@ public:
|
||||||
else if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
|
else if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
|
||||||
// Iterate through the decls. Warn if any initializers are complex
|
// Iterate through the decls. Warn if any initializers are complex
|
||||||
// expressions that are not live (never used).
|
// expressions that are not live (never used).
|
||||||
for (ScopedDecl* SD = DS->getDecl(); SD; SD = SD->getNextDeclarator()) {
|
for (ScopedDecl* SD = DS->getDecl(); SD; SD = SD->getNextDeclarator()) {
|
||||||
|
|
||||||
VarDecl* V = dyn_cast<VarDecl>(SD);
|
VarDecl* V = dyn_cast<VarDecl>(SD);
|
||||||
if (!V) continue;
|
if (!V) continue;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче