@@ -254,8 +254,8 @@ std::vector<LocatedSymbol> locateSymbolAt(ParsedAST &AST, Position Pos,
254
254
}
255
255
}
256
256
257
- SourceLocation SourceLocationBeg =
258
- getBeginningOfIdentifier (AST, Pos, SM. getMainFileID ());
257
+ SourceLocation SourceLocationBeg = getBeginningOfIdentifier (
258
+ Pos, AST. getSourceManager (), AST. getASTContext (). getLangOpts ());
259
259
260
260
// Macros are simple: there's no declaration/definition distinction.
261
261
// As a consequence, there's no need to look them up in the index either.
@@ -408,10 +408,10 @@ std::vector<DocumentHighlight> findDocumentHighlights(ParsedAST &AST,
408
408
Position Pos) {
409
409
const SourceManager &SM = AST.getSourceManager ();
410
410
// FIXME: show references to macro within file?
411
- auto References =
412
- findRefs ( getDeclAtPosition (
413
- AST, getBeginningOfIdentifier (AST, Pos, SM. getMainFileID ())),
414
- AST);
411
+ auto References = findRefs (
412
+ getDeclAtPosition (AST, getBeginningOfIdentifier (
413
+ Pos, SM, AST. getASTContext (). getLangOpts ())),
414
+ AST);
415
415
416
416
// FIXME: we may get multiple DocumentHighlights with the same location and
417
417
// different kinds, deduplicate them.
@@ -876,7 +876,7 @@ llvm::Optional<HoverInfo> getHover(ParsedAST &AST, Position Pos,
876
876
const SymbolIndex *Index) {
877
877
llvm::Optional<HoverInfo> HI;
878
878
SourceLocation SourceLocationBeg = getBeginningOfIdentifier (
879
- AST, Pos, AST.getSourceManager (). getMainFileID ());
879
+ Pos, AST.getSourceManager (), AST. getASTContext (). getLangOpts ());
880
880
881
881
if (auto M = locateMacroAt (SourceLocationBeg, AST.getPreprocessor ())) {
882
882
HI = getHoverContents (*M, AST);
@@ -918,7 +918,8 @@ std::vector<Location> findReferences(ParsedAST &AST, Position Pos,
918
918
elog (" Failed to get a path for the main file, so no references" );
919
919
return Results;
920
920
}
921
- auto Loc = getBeginningOfIdentifier (AST, Pos, SM.getMainFileID ());
921
+ auto Loc =
922
+ getBeginningOfIdentifier (Pos, SM, AST.getASTContext ().getLangOpts ());
922
923
// TODO: should we handle macros, too?
923
924
auto Decls = getDeclAtPosition (AST, Loc);
924
925
@@ -974,8 +975,8 @@ std::vector<Location> findReferences(ParsedAST &AST, Position Pos,
974
975
975
976
std::vector<SymbolDetails> getSymbolInfo (ParsedAST &AST, Position Pos) {
976
977
const SourceManager &SM = AST.getSourceManager ();
977
-
978
- auto Loc = getBeginningOfIdentifier (AST, Pos, SM. getMainFileID ());
978
+ auto Loc =
979
+ getBeginningOfIdentifier (Pos, SM, AST. getASTContext (). getLangOpts ());
979
980
980
981
std::vector<SymbolDetails> Results;
981
982
@@ -1146,7 +1147,7 @@ static void fillSuperTypes(const CXXRecordDecl &CXXRD, ASTContext &ASTCtx,
1146
1147
1147
1148
const CXXRecordDecl *findRecordTypeAt (ParsedAST &AST, Position Pos) {
1148
1149
SourceLocation SourceLocationBeg = getBeginningOfIdentifier (
1149
- AST, Pos, AST.getSourceManager (). getMainFileID ());
1150
+ Pos, AST.getSourceManager (), AST. getASTContext (). getLangOpts ());
1150
1151
auto Decls = getDeclAtPosition (AST, SourceLocationBeg);
1151
1152
if (Decls.empty ())
1152
1153
return nullptr ;
0 commit comments