diff options
author | Haojian Wu <hokein.wu@gmail.com> | 2025-06-26 14:12:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-26 14:12:51 +0200 |
commit | 0b6ddb02efdcbdac9426e8d857499ea0580303cd (patch) | |
tree | eed7f54265dca87249adc7155112d50ded8c540d /clang/lib/Frontend | |
parent | 548e8e92e98d727534aff93771e032696aca11e3 (diff) | |
download | llvm-0b6ddb02efdcbdac9426e8d857499ea0580303cd.zip llvm-0b6ddb02efdcbdac9426e8d857499ea0580303cd.tar.gz llvm-0b6ddb02efdcbdac9426e8d857499ea0580303cd.tar.bz2 |
[clang] NFC: Add alias for std::pair<FileID, unsigned> used in SourceLocation (#145711)
Introduce a type alias for the commonly used `std::pair<FileID,
unsigned>` to improve code readability, and make it easier for future
updates (64-bit source locations).
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/SARIFDiagnostic.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/TextDiagnostic.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Frontend/SARIFDiagnostic.cpp b/clang/lib/Frontend/SARIFDiagnostic.cpp index e2aec7f6..ac27d74 100644 --- a/clang/lib/Frontend/SARIFDiagnostic.cpp +++ b/clang/lib/Frontend/SARIFDiagnostic.cpp @@ -91,8 +91,8 @@ SarifResult SARIFDiagnostic::addLocationToResult( SourceLocation E = ERange.getEnd(); bool IsTokenRange = ERange.isTokenRange(); - std::pair<FileID, unsigned> BInfo = SM.getDecomposedLoc(B); - std::pair<FileID, unsigned> EInfo = SM.getDecomposedLoc(E); + FileIDAndOffset BInfo = SM.getDecomposedLoc(B); + FileIDAndOffset EInfo = SM.getDecomposedLoc(E); // If the start or end of the range is in another file, just discard // it. diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index b9e681b..ccdd59d 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -1012,7 +1012,7 @@ static std::string buildFixItInsertionLine(FileID FID, unsigned LineNo, // We have an insertion hint. Determine whether the inserted // code contains no newlines and is on the same line as the caret. - std::pair<FileID, unsigned> HintLocInfo = + FileIDAndOffset HintLocInfo = SM.getDecomposedExpansionLoc(H.RemoveRange.getBegin()); if (FID == HintLocInfo.first && LineNo == SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) && @@ -1518,8 +1518,8 @@ void TextDiagnostic::emitParseableFixits(ArrayRef<FixItHint> Hints, SourceLocation BLoc = H.RemoveRange.getBegin(); SourceLocation ELoc = H.RemoveRange.getEnd(); - std::pair<FileID, unsigned> BInfo = SM.getDecomposedLoc(BLoc); - std::pair<FileID, unsigned> EInfo = SM.getDecomposedLoc(ELoc); + FileIDAndOffset BInfo = SM.getDecomposedLoc(BLoc); + FileIDAndOffset EInfo = SM.getDecomposedLoc(ELoc); // Adjust for token ranges. if (H.RemoveRange.isTokenRange()) |