[clang] [clang][index][USR] GenLoc prints file entry at most once, allow repeated offsets (PR #205430)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 16:49:07 PDT 2026
================
@@ -24,6 +24,22 @@ using namespace clang::index;
// USR generation.
//===----------------------------------------------------------------------===//
+/// Print only the offset part of \p Loc
+/// \returns true on error.
+static bool printLocOffset(llvm::raw_ostream &OS, SourceLocation Loc,
+ const SourceManager &SM) {
+ if (Loc.isInvalid())
+ return true;
+ Loc = SM.getExpansionLoc(Loc);
----------------
ziqingluo-90 wrote:
You are right. Even though having the same expansion but different spelling locations for decls seems to be a rare case to me, it is worth fixing.
https://github.com/llvm/llvm-project/pull/205430
More information about the cfe-commits
mailing list