diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -52,6 +52,7 @@ #include "clang/Sema/CodeCompleteConsumer.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/Sema.h" +#include "clang/Tooling/Syntax/Tokens.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" @@ -588,9 +589,10 @@ // Case 4: There was a qualifier, and Sema didn't resolve it. Scopes.AccessibleScopes.push_back(""); // Make sure global scope is included. - llvm::StringRef SpelledSpecifier = Lexer::getSourceText( - CharSourceRange::getCharRange(SemaSpecifier->getRange()), - CCSema.SourceMgr, clang::LangOptions()); + llvm::StringRef SpelledSpecifier = + syntax::FileRange(CCSema.SourceMgr, SemaSpecifier->getBeginLoc(), + SemaSpecifier->getEndLoc()) + .text(CCSema.SourceMgr); if (SpelledSpecifier.consume_front("::")) Scopes.AccessibleScopes = {""}; Scopes.UnresolvedQualifier = std::string(SpelledSpecifier);