diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-05-11 18:26:10 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-05-11 18:26:10 +0000 |
commit | f73d5f23a889b93d89ddef61ac0995df40286bb8 (patch) | |
tree | c89fa0adefb99f464eba263b447f84c2ceb663ce /lib/Analysis/Consumed.cpp | |
parent | 33fa48314f06936f83859852feb3c0ce68b08c0c (diff) |
Notes
Diffstat (limited to 'lib/Analysis/Consumed.cpp')
-rw-r--r-- | lib/Analysis/Consumed.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Analysis/Consumed.cpp b/lib/Analysis/Consumed.cpp index b33c8d8930f84..e5ec3e6b927d1 100644 --- a/lib/Analysis/Consumed.cpp +++ b/lib/Analysis/Consumed.cpp @@ -605,13 +605,25 @@ void ConsumedStmtVisitor::VisitBinaryOperator(const BinaryOperator *BinOp) { } } +static bool isStdNamespace(const DeclContext *DC) { + if (!DC->isNamespace()) return false; + while (DC->getParent()->isNamespace()) + DC = DC->getParent(); + const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC); + + return ND && ND->getName() == "std" && + ND->getDeclContext()->isTranslationUnit(); +} + void ConsumedStmtVisitor::VisitCallExpr(const CallExpr *Call) { if (const FunctionDecl *FunDecl = dyn_cast_or_null<FunctionDecl>(Call->getDirectCallee())) { // Special case for the std::move function. // TODO: Make this more specific. (Deferred) - if (FunDecl->getNameAsString() == "move") { + if (Call->getNumArgs() == 1 && + FunDecl->getNameAsString() == "move" && + isStdNamespace(FunDecl->getDeclContext())) { forwardInfo(Call->getArg(0), Call); return; } |