Skip to content

Commit d5fca51

Browse files
Reuse SourceManager.getFileLoc method
1 parent 0772e07 commit d5fca51

File tree

4 files changed

+62
-96
lines changed

4 files changed

+62
-96
lines changed

clang/include/clang/Basic/SourceManager.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,22 +1250,6 @@ class SourceManager : public RefCountedBase<SourceManager> {
12501250
return getSpellingLocSlowCase(Loc);
12511251
}
12521252

1253-
/// Given a SourceLocation object, return the refined spelling
1254-
/// location referenced by the ID.
1255-
///
1256-
/// The key difference to \ref getSpellingLoc is that the source location
1257-
/// for macro body is resolved to the expansion site.
1258-
///
1259-
/// This is the place where the characters that make up the lexed token
1260-
/// can be found.
1261-
SourceLocation getRefinedSpellingLoc(SourceLocation Loc) const {
1262-
// Handle the non-mapped case inline, defer to out of line code to handle
1263-
// expansions.
1264-
if (Loc.isFileID())
1265-
return Loc;
1266-
return getRefinedSpellingLocSlowCase(Loc);
1267-
}
1268-
12691253
/// Given a SourceLocation object, return the spelling location
12701254
/// referenced by the ID.
12711255
///

clang/lib/Basic/SourceManager.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,7 @@ SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const {
915915
return Loc;
916916
}
917917

918-
SourceLocation
919-
SourceManager::getRefinedSpellingLocSlowCase(SourceLocation Loc) const {
918+
SourceLocation SourceManager::getFileLocSlowCase(SourceLocation Loc) const {
920919
do {
921920
const SLocEntry &Entry = getSLocEntry(getFileID(Loc));
922921
const ExpansionInfo &ExpInfo = Entry.getExpansion();
@@ -930,16 +929,6 @@ SourceManager::getRefinedSpellingLocSlowCase(SourceLocation Loc) const {
930929
return Loc;
931930
}
932931

933-
SourceLocation SourceManager::getFileLocSlowCase(SourceLocation Loc) const {
934-
do {
935-
if (isMacroArgExpansion(Loc))
936-
Loc = getImmediateSpellingLoc(Loc);
937-
else
938-
Loc = getImmediateExpansionRange(Loc).getBegin();
939-
} while (!Loc.isFileID());
940-
return Loc;
941-
}
942-
943932
FileIDAndOffset SourceManager::getDecomposedExpansionLocSlowCase(
944933
const SrcMgr::SLocEntry *E) const {
945934
// If this is an expansion record, walk through all the expansion points.

0 commit comments

Comments
 (0)