[PATCH] D94231: [clang][Sema] Compare SourceLocations directly [NFCI]

2021-01-09 Thread Mikhail Maltsev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f76788b0930: [clang][Sema] Compare SourceLocations directly 
[NFCI] (authored by miyuki).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94231/new/

https://reviews.llvm.org/D94231

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaStmt.cpp


Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -672,8 +672,7 @@
 return true;
 
   if (lhs.first == rhs.first &&
-  lhs.second->getCaseLoc().getRawEncoding()
-   < rhs.second->getCaseLoc().getRawEncoding())
+  lhs.second->getCaseLoc() < rhs.second->getCaseLoc())
 return true;
   return false;
 }
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -436,9 +436,7 @@
  Res != ResEnd; ++Res) {
   if (isa(*Res) || isa(*Res) ||
   (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) {
-if (!IIDecl ||
-(*Res)->getLocation().getRawEncoding() <
-  IIDecl->getLocation().getRawEncoding())
+if (!IIDecl || (*Res)->getLocation() < IIDecl->getLocation())
   IIDecl = *Res;
   }
 }


Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -672,8 +672,7 @@
 return true;
 
   if (lhs.first == rhs.first &&
-  lhs.second->getCaseLoc().getRawEncoding()
-   < rhs.second->getCaseLoc().getRawEncoding())
+  lhs.second->getCaseLoc() < rhs.second->getCaseLoc())
 return true;
   return false;
 }
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -436,9 +436,7 @@
  Res != ResEnd; ++Res) {
   if (isa(*Res) || isa(*Res) ||
   (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) {
-if (!IIDecl ||
-(*Res)->getLocation().getRawEncoding() <
-  IIDecl->getLocation().getRawEncoding())
+if (!IIDecl || (*Res)->getLocation() < IIDecl->getLocation())
   IIDecl = *Res;
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94231: [clang][Sema] Compare SourceLocations directly [NFCI]

2021-01-08 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Based on your explanation, this seems good. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94231/new/

https://reviews.llvm.org/D94231

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94231: [clang][Sema] Compare SourceLocations directly [NFCI]

2021-01-07 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: dexonsmith, aprantl, rsmith.
miyuki requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The ordered comparison operators are defined for the SourceLocation
class, so SourceLocation objects can be compared directly. There is no
need to extract the internal representation for comparison.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94231

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaStmt.cpp


Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -672,8 +672,7 @@
 return true;
 
   if (lhs.first == rhs.first &&
-  lhs.second->getCaseLoc().getRawEncoding()
-   < rhs.second->getCaseLoc().getRawEncoding())
+  lhs.second->getCaseLoc() < rhs.second->getCaseLoc())
 return true;
   return false;
 }
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -436,9 +436,7 @@
  Res != ResEnd; ++Res) {
   if (isa(*Res) || isa(*Res) ||
   (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) {
-if (!IIDecl ||
-(*Res)->getLocation().getRawEncoding() <
-  IIDecl->getLocation().getRawEncoding())
+if (!IIDecl || (*Res)->getLocation() < IIDecl->getLocation())
   IIDecl = *Res;
   }
 }


Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -672,8 +672,7 @@
 return true;
 
   if (lhs.first == rhs.first &&
-  lhs.second->getCaseLoc().getRawEncoding()
-   < rhs.second->getCaseLoc().getRawEncoding())
+  lhs.second->getCaseLoc() < rhs.second->getCaseLoc())
 return true;
   return false;
 }
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -436,9 +436,7 @@
  Res != ResEnd; ++Res) {
   if (isa(*Res) || isa(*Res) ||
   (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) {
-if (!IIDecl ||
-(*Res)->getLocation().getRawEncoding() <
-  IIDecl->getLocation().getRawEncoding())
+if (!IIDecl || (*Res)->getLocation() < IIDecl->getLocation())
   IIDecl = *Res;
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits