diff options
| author | Richard Trieu <rtrieu@google.com> | 2014-09-25 01:15:40 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2014-09-25 01:15:40 +0000 |
| commit | 52b8b60d4c6f863db63ef747013dd119169557a2 (patch) | |
| tree | 9affc116592ef6b016a08438439a9e3f65858db1 /clang/lib/Sema | |
| parent | a577bc26b6141673b1bf4a339953ab2c04b34a8d (diff) | |
| download | bcm5719-llvm-52b8b60d4c6f863db63ef747013dd119169557a2.tar.gz bcm5719-llvm-52b8b60d4c6f863db63ef747013dd119169557a2.zip | |
Add increment/decrement operators and compound assignment operators to the
uninitialized checkers that did not have them before.
llvm-svn: 218435
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 16 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 11 |
2 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 277816be429..1bac28753fe 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8452,6 +8452,12 @@ namespace { HandleValue(E->getSubExpr()); return; } + + if (E->isIncrementDecrementOp()) { + HandleValue(E->getSubExpr()); + return; + } + Inherited::VisitUnaryOperator(E); } @@ -8480,6 +8486,16 @@ namespace { Inherited::VisitCallExpr(E); } + void VisitBinaryOperator(BinaryOperator *E) { + if (E->isCompoundAssignmentOp()) { + HandleValue(E->getLHS()); + Visit(E->getRHS()); + return; + } + + Inherited::VisitBinaryOperator(E); + } + // A custom visitor for BinaryConditionalOperator is needed because the // regular visitor would check the condition and true expression separately // but both point to the same place giving duplicate diagnostics. diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 006a3c49d7c..bf53ae38ddb 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2382,8 +2382,19 @@ namespace { if (!FD->getType()->isReferenceType()) DeclsToRemove.push_back(FD); + if (E->isCompoundAssignmentOp()) { + HandleValue(E->getLHS()); + } + Inherited::VisitBinaryOperator(E); } + + void VisitUnaryOperator(UnaryOperator *E) { + if (E->isIncrementDecrementOp()) + HandleValue(E->getSubExpr()); + + Inherited::VisitUnaryOperator(E); + } }; // Diagnose value-uses of fields to initialize themselves, e.g. |

