bkramer added inline comments.

================
Comment at: clangd/ProtocolHandlers.cpp:117
+  // starting from there.
+  StringRef Code = Store.getDocument(DOTFP->textDocument.uri);
+  size_t CursorPos = positionToOffset(Code, DOTFP->position);
----------------
This should be a std::string in trunk, StringRef gives you a use after free.


================
Comment at: clangd/ProtocolHandlers.cpp:119
+  size_t CursorPos = positionToOffset(Code, DOTFP->position);
+  size_t PreviousLBracePos = Code.find_last_of("{", CursorPos);
+  if (PreviousLBracePos == StringRef::npos)
----------------
nit: use the character overload of this function (`Code.find_last_of('{'...`)


https://reviews.llvm.org/D29990



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

Reply via email to