diff options
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/passstuffbyref.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/test/passstuffbyref.cxx | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx index aca8b89da5a3..54982fdfc045 100644 --- a/compilerplugins/clang/passstuffbyref.cxx +++ b/compilerplugins/clang/passstuffbyref.cxx @@ -380,6 +380,10 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr) return isReturnExprDisqualified(condOper->getTrueExpr()) || isReturnExprDisqualified(condOper->getFalseExpr()); } + if (auto unaryOp = dyn_cast<UnaryOperator>(expr)) { + expr = unaryOp->getSubExpr(); + continue; + } if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(expr)) { // TODO could improve this, but sometimes it means we're returning a copy of a temporary. // Same logic as CXXOperatorCallExpr::isAssignmentOp(), which our supported clang diff --git a/compilerplugins/clang/test/passstuffbyref.cxx b/compilerplugins/clang/test/passstuffbyref.cxx index ed86d4d309d9..71c219c986ec 100644 --- a/compilerplugins/clang/test/passstuffbyref.cxx +++ b/compilerplugins/clang/test/passstuffbyref.cxx @@ -52,6 +52,7 @@ struct S2 { OUString set5(OUString const & s) { return s; } OUString set6() { std::vector<OUString> v1(1); return v1[0]; } OUString set7(S1 const & s) { return s.get(); } + OUString set8() { OUString * p = nullptr; return *p; } }; |