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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 06:57:39 PDT 2017


alexfh added a comment.

A few more nits.



================
Comment at: unittests/Tooling/DiagnosticsYamlTest.cpp:39
+
+  StringMap<Replacements> Fix1{
+    { "path/to/source.cpp", Replacements(Replacement("path/to/source.cpp", 100,
----------------
The assignment form of initialization is clearer for containers (and actually any type for which the initialization means "this variable is whatever is on the right side of the assignment" as opposed to "this variable is initialized by a constructor call taking these parameters").


================
Comment at: unittests/Tooling/DiagnosticsYamlTest.cpp:60
+
+  EXPECT_STREQ("---\n"
+    "MainSourceFile:  path/to/source.cpp\n"
----------------
Why not EXPECT_EQ (and remove `.c_str()` from the second argument)?


================
Comment at: unittests/clang-apply-replacements/ApplyReplacementsTest.cpp:27
+  TU.MainSourceFile = MainSourceFile;
+  TU.Diagnostics.push_back(Diagnostic(DiagnosticName, Message, Replacements, {}, 
+                                      Diagnostic::Warning, BuildDirectory));
----------------
I believe, this can be expressed a bit less verbosely, e.g. `TUs.push_back({ MainSourceFile, {Diagnostic(...)}});`.


Repository:
  rL LLVM

https://reviews.llvm.org/D34404





More information about the cfe-commits mailing list