[PATCH] D35894: [clangd] Code hover for Clangd

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 13:53:12 PST 2017


malaperle added inline comments.


================
Comment at: clangd/ClangdUnit.cpp:1029
+  SourceLocation LocStart = ValSourceRange.getBegin();
+  SourceLocation LocEnd = Lexer::getLocForEndOfToken(ValSourceRange.getEnd(), 0,
+                                                     SourceMgr, LangOpts);
----------------
  const FileEntry *F =
          SourceMgr.getFileEntryForID(SourceMgr.getFileID(LocStart));
  if (!F)
    return llvm::errc::no_such_file_or_directory;


================
Comment at: clangd/ClangdUnit.cpp:1039
+  Location L;
+  if (const FileEntry *F =
+          SourceMgr.getFileEntryForID(SourceMgr.getFileID(LocStart))) {
----------------
FE can be null. How about returning a llvm::ErrorOr ?


================
Comment at: clangd/ClangdUnit.cpp:1242
+
+  const FileEntry *FE =
+      AST.getASTContext().getSourceManager().getFileManager().getFile(
----------------
FE can be null. How about returning a llvm::ErrorOr ?


https://reviews.llvm.org/D35894





More information about the cfe-commits mailing list