[PATCH] D60383: FileCheck [3/12]: Stricter parsing of @LINE expressions

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 07:27:27 PDT 2019


arichardson added inline comments.


================
Comment at: llvm/lib/Support/FileCheck.cpp:95
+    SM.PrintMessage(oploc, SourceMgr::DK_Error,
+                    std::string("Unsupported numeric operation '") + Operator +
+                        "'");
----------------
thopre wrote:
> arsenm wrote:
> > I thought these used Twine, not std::string?
> It is but there is an implicit conversion from the latter to the former. Using Twine directly makes the diagnostic string less readable due to akward concatenation:
> 
>  Twine("Unsupported numeric operation '").concat(Twine(Operator)).concat("'")
> 
> I feel the current code provides better readability.
I think `StringRef("Unsupported numeric operation '") + Operator + "'"` should also work and won't create a copy for the std::string.


================
Comment at: llvm/lib/Support/FileCheck.cpp:60
+// Parsing helper function that strips the first character in s and returns it.
+static char next(StringRef &s) {
+  char c = s.front();
----------------
I guess this should be `S`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60383/new/

https://reviews.llvm.org/D60383





More information about the llvm-commits mailing list