[PATCH] D34404: [Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output

Vladimir Plyashkun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 09:37:57 PDT 2017


vladimir.plyashkun added inline comments.


================
Comment at: unittests/clang-apply-replacements/ApplyReplacementsTest.cpp:18
+
+static tooling::Diagnostic makeDiagnostic(const StringRef DiagnosticName,
+                                          DiagnosticMessage &Message,
----------------
alexfh wrote:
> I'd remove `const` from `DiagnosticName`, since a StringRef doesn't allow to modify the string it points to (and marking by value arguments `const` is not common in LLVM). However, `Message` and `Replacements` allow to modify the referenced objects and thus should be marked `const`.
> 
> Also consider inlining this method, it doesn't buy you much.
Same for here. 
Constructor for `Diagnostic` class requires non-const references for `Message` and `Replacements` arguments. So, it's invalid to mark them as `const`.


Repository:
  rL LLVM

https://reviews.llvm.org/D34404





More information about the cfe-commits mailing list