[PATCH] D45835: Add new driver mode for dumping compiler options

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 10:56:10 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Frontend/FrontendActions.cpp:779
+  {
+    std::string Str;
+#define FEATURE(Name, Predicate)                                               \
----------------
This is likely to do an allocation for each feature.
Maybe consider `llvm::SmallString<64>`


================
Comment at: lib/Frontend/FrontendActions.cpp:781
+#define FEATURE(Name, Predicate)                                               \
+  Str += "\t{\"" #Name "\" : " + std::string(Predicate ? "true" : "false") +   \
+         "},\n";
----------------
Similarly, you may want to explicitly use `llvm::Twine` here


================
Comment at: lib/Frontend/FrontendActions.cpp:791
+
+  OS << "\n\"extensions\" : [\n";
+  {
----------------
same


https://reviews.llvm.org/D45835





More information about the cfe-commits mailing list