Summary:
Clang-tidy is reporting a warning of redundant string initialisation
on a string parameter initialized with empty string.
See bug: 27087
The reported example is:
```
#include <string>
void fn(std::string a = "");
```
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18829
llvm-svn: 265671
hasInitializer(
expr(anyOf(EmptyStringCtorExpr,
EmptyStringCtorExprWithTemporaries))
- .bind("expr"))))
+ .bind("expr"))),
+ unless(parmVarDecl()))
.bind("decl"),
this);
}
std::string d = "u", e = "u", f = "u";
}
+
+// These cases should not generate warnings.
+extern void Param1(std::string param = "");
+extern void Param2(const std::string& param = "");
+void Param3(std::string param = "") {}
+void Param4(STRING param = "") {}
+