diff options
| author | Richard Trieu <rtrieu@google.com> | 2014-08-26 04:30:55 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2014-08-26 04:30:55 +0000 |
| commit | 11fd079b6e47148b6f81a6390eae0d2d9e0a035c (patch) | |
| tree | cb49e9fb3241da3af2f363c8fce431bad39670a4 /clang/lib/Analysis | |
| parent | 43ccec8e5314dcd7091e47a98ae08ef86c154697 (diff) | |
| download | bcm5719-llvm-11fd079b6e47148b6f81a6390eae0d2d9e0a035c.tar.gz bcm5719-llvm-11fd079b6e47148b6f81a6390eae0d2d9e0a035c.zip | |
Passing a variable to std::move now counts as a use for -Wuninitialized
llvm-svn: 216438
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/UninitializedValues.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index 0f93fe8981c..da4d072807c 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -341,6 +341,16 @@ void ClassifyRefs::VisitUnaryOperator(UnaryOperator *UO) { } void ClassifyRefs::VisitCallExpr(CallExpr *CE) { + // Classify arguments to std::move as used. + if (CE->getNumArgs() == 1) { + if (FunctionDecl *FD = CE->getDirectCallee()) { + if (FD->getIdentifier() && FD->getIdentifier()->isStr("move")) { + classify(CE->getArg(0), Use); + return; + } + } + } + // If a value is passed by const reference to a function, we should not assume // that it is initialized by the call, and we conservatively do not assume // that it is used. |

