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

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 01:42:14 PDT 2019


thopre added a comment.

In D60383#1483748 <https://reviews.llvm.org/D60383#1483748>, @thopre wrote:

> In D60383#1482917 <https://reviews.llvm.org/D60383#1482917>, @rnk wrote:
>
> > The newly added test fails on Windows:
> >  http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/6381
> >
> > This appears to be the fix:
> >
> >   bool parseExpect(std::string &VarName, std::string &Trailer) {
> >
> > - StringRef NameTrailer = StringRef(VarName + Trailer); +    std::string NameTrailer = VarName + Trailer;
>
>
> Sadly I cannot reproduce it. I tried a stage2 build just in case but I still don't hit it. I'm also a bit confused by what is happening. Does the temporary std::string created by the + operator dies before NameTrailer is used? Anyway, if your patch works could you try std::string &NameTrailer = VarName + Trailer instead? I believe that removes an unnecessary copy from the temporary std::string created by the + operator to the NameTrailer one.
>
> Thanks for the patch!


Oh I'm always doing Debug builds so probably at -O0 the std::string is actually created and stays valid when it's copied in the memory buffer while in a release build the compiler might not even create the temporary concatenated string or destroys it quickly.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60383





More information about the llvm-commits mailing list