diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp index 478bd85177143..0d2294e1e9bb0 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp @@ -208,6 +208,8 @@ bool isASafeCallArg(const Expr *E) { return true; } } + if (isa(E)) + return true; // A temporary lives until the end of this statement. if (isConstOwnerPtrMemberExpr(E)) return true; diff --git a/clang/test/Analysis/Checkers/WebKit/unchecked-call-arg.cpp b/clang/test/Analysis/Checkers/WebKit/unchecked-call-arg.cpp index 8685978ebf1ac..b89a3246606ed 100644 --- a/clang/test/Analysis/Checkers/WebKit/unchecked-call-arg.cpp +++ b/clang/test/Analysis/Checkers/WebKit/unchecked-call-arg.cpp @@ -32,3 +32,8 @@ void foo() { provide()->doWork(); // expected-warning@-1{{Call argument for 'this' parameter is unchecked and unsafe}} } + +void doWorkWithObject(const CheckedObject&); +void bar() { + doWorkWithObject(CheckedObject()); +}