[clang] 4be67d4 - [clang][NFC] Give BeforeThanCompare const refs to SourceManager (#239058)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 16:00:29 PST 2026


Author: Nico Weber
Date: 2026-11-06T19:00:23-05:00
New Revision: 4be67d4e83312bf441ab0adfed336cf76402ca78

URL: https://github.com/llvm/llvm-project/commit/4be67d4e83312bf441ab0adfed336cf76402ca78
DIFF: https://github.com/llvm/llvm-project/commit/4be67d4e83312bf441ab0adfed336cf76402ca78.diff

LOG: [clang][NFC] Give BeforeThanCompare const refs to SourceManager (#239058)

No reason for this to not be const.

No behavior change.

Added: 
    

Modified: 
    clang/include/clang/Basic/SourceManager.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index 142350130a71d..aa4d35401d8fe 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -2012,10 +2012,10 @@ class BeforeThanCompare;
 /// Compare two source locations.
 template<>
 class BeforeThanCompare<SourceLocation> {
-  SourceManager &SM;
+  const SourceManager &SM;
 
 public:
-  explicit BeforeThanCompare(SourceManager &SM) : SM(SM) {}
+  explicit BeforeThanCompare(const SourceManager &SM) : SM(SM) {}
 
   bool operator()(SourceLocation LHS, SourceLocation RHS) const {
     return SM.isBeforeInTranslationUnit(LHS, RHS);
@@ -2025,10 +2025,10 @@ class BeforeThanCompare<SourceLocation> {
 /// Compare two non-overlapping source ranges.
 template<>
 class BeforeThanCompare<SourceRange> {
-  SourceManager &SM;
+  const SourceManager &SM;
 
 public:
-  explicit BeforeThanCompare(SourceManager &SM) : SM(SM) {}
+  explicit BeforeThanCompare(const SourceManager &SM) : SM(SM) {}
 
   bool operator()(SourceRange LHS, SourceRange RHS) const {
     return SM.isBeforeInTranslationUnit(LHS.getBegin(), RHS.getBegin());


        


More information about the cfe-commits mailing list