@@ -900,8 +900,8 @@ static void setLocationInfoForRange(SourceManager &SM, SourceRange R,
900
900
SM.getLineAndColumnInBuffer (CR.getStart (), BufID);
901
901
}
902
902
903
- static void setLocationInfo (const ValueDecl *VD,
904
- LocationInfo & Location) {
903
+ static LocationInfo getDeclLocationInfo (const ValueDecl *VD) {
904
+ LocationInfo Location;
905
905
ASTContext &Ctx = VD->getASTContext ();
906
906
SourceManager &SM = Ctx.SourceMgr ;
907
907
auto *Importer = static_cast <ClangImporter *>(Ctx.getClangModuleLoader ());
@@ -963,19 +963,19 @@ static void setLocationInfo(const ValueDecl *VD,
963
963
// original file might be tricky.
964
964
setLocationInfoForRange (SM, VDRange, VDBufID, Location);
965
965
}
966
- return ;
966
+ return Location ;
967
967
case GeneratedSourceInfo::AttributeFromClang:
968
968
// This buffer was generated for an imported ClangNode, so set location
969
969
// info according to that.
970
970
if (auto node = info->clangNode )
971
971
setLocationInfoForClangNode (node, Importer, Location);
972
972
else
973
973
setLocationInfoForRange (SM, VDRange, VDBufID, Location);
974
- return ;
974
+ return Location ;
975
975
case GeneratedSourceInfo::DefaultArgument:
976
976
case GeneratedSourceInfo::PrettyPrinted:
977
977
setLocationInfoForRange (SM, VDRange, VDBufID, Location);
978
- return ;
978
+ return Location ;
979
979
}
980
980
llvm_unreachable (" All switch cases either explicitly continue or return" );
981
981
}
@@ -984,6 +984,7 @@ static void setLocationInfo(const ValueDecl *VD,
984
984
} else if (auto CNode = VD->getClangNode ()) {
985
985
setLocationInfoForClangNode (CNode, Importer, Location);
986
986
}
987
+ return Location;
987
988
}
988
989
989
990
static llvm::Error
@@ -1142,7 +1143,7 @@ fillSymbolInfo(CursorSymbolInfo &Symbol, const DeclInfo &DInfo,
1142
1143
Lang.getIFaceGenContexts ().find (Symbol.ModuleName , Invoc))
1143
1144
Symbol.ModuleInterfaceName = IFaceGenRef->getDocumentName ();
1144
1145
1145
- setLocationInfo (DInfo.OriginalProperty , Symbol. Location );
1146
+ Symbol. Location = getDeclLocationInfo (DInfo.OriginalProperty );
1146
1147
if (!Symbol.Location .Filename .empty ()) {
1147
1148
mapLocToLatestSnapshot (Lang, Symbol.Location , PreviousSnaps);
1148
1149
if (Symbol.Location .Filename .empty ()) {
0 commit comments