bernhardmgruber added inline comments.

================
Comment at: clang-tidy/modernize/UseTrailingReturnCheck.cpp:335
+  StringRef ReturnType = tooling::fixit::getText(ReturnTypeCVRange, Ctx);
+  StringRef Auto = std::isspace(*ReturnType.end()) // FIXME (dereferencing end)
+                       ? "auto"
----------------
JonasToth wrote:
> bernhardmgruber wrote:
> > FIXME: this feels wrong when I wrote it, but it works. I tried to fiddle 
> > with the ReturnTypeCVRange to include the next charakter, but I could not 
> > get it working without writing `tooling::fixit::getText` myself. Any ideas?
> That only works, because `StringRef` points within the orignal code buffer. 
> IMHO just adding the space always and letting clang-format do its job is 
> better then this potential out-of-bounds read.
> Maybe you could increase the `ReturnTypeCVRange` by one at the end, then its 
> fine.
I now retrieve the space after the return type explicitely. Using clang-format 
afterwards is not always possible on the code bases I work with, so I would 
like to not rely on it.


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

https://reviews.llvm.org/D56160



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to