[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

Dean Michael Berris via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 21:46:39 PDT 2016


dberris added inline comments.


> rSerge wrote in Tools.cpp:4787
> Is there any advantage over `const char* const` here?

This same value is turned into a string later on anyway. You can make it a std::string and std::move(...) it at the call to CmdArgs.push_back(...).

> rSerge wrote in Tools.cpp:4796
> It returns `StringRef`. `.str()` would construct a `std::string`, which seems unnecessary.  Of course this piece is not performance-critical, but why not to just use `operator+=` taking as the argument `const char* const`?

.data() doesn't necessarily have a null terminator.

Constructing a string out of successive +'s invoke move constructors on std::string, which makes it as efficient if not more efficient than growing a single string this way. At any rate it's much more readable if you did it in a single line.

https://reviews.llvm.org/D24799





More information about the cfe-commits mailing list