flx added inline comments.

================
Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:242
+// Case where parameter in declaration is already const-qualified but not in
+// implementation. Make sure a second 'const' is not added to the declaration.
+void PositiveConstDeclaration(const ExpensiveToCopyType A);
----------------
aaron.ballman wrote:
> This comment doesn't really match the test cases. The original code has two 
> *different* declarations (only one of which is a definition), not one 
> declaration and one redeclaration with the definition.
> 
> I think what is really happening is that it is adding the `&` qualifier to 
> the first declaration, and adding the `const` and `&` qualifiers to the 
> second declaration, and the result is that you get harmonization. But it 
> brings up a question to me; what happens with:
> ```
> void f1(ExpensiveToCopyType A) {
> }
> 
> void f1(const ExpensiveToCopyType A) {
> 
> }
> ```
> Does the fix-it try to create two definitions of the same function?
Good catch. I added the reverse case as well and modified the check slightly to 
make that case work as well.


================
Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:244
+void PositiveConstDeclaration(const ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveConstDeclaration(ExpensiveToCopyType A) {
----------------
aaron.ballman wrote:
> Is the `CHECK-MESSAGES` missing?
The message is only generated on the definition below, the declaration will 
only have a fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D26207



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to