Scarlet1ssimo created this revision.
Herald added subscribers: steakhal, manas, ASDenysPetrov, martong, dkrupp, 
donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, 
xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
Scarlet1ssimo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

LocInfo is 0 based, but column number is 1 based. So in the corner case,
LocInfo.second + 1 == SM.getExpansionColumnNumber(Loc)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143867

Files:
  clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp


Index: clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
@@ -158,7 +158,7 @@
   assert(!Loc.isInvalid() && "invalid Loc when adjusting column position");
 
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedExpansionLoc(Loc);
-  assert(LocInfo.second > SM.getExpansionColumnNumber(Loc) &&
+  assert(LocInfo.second + 1 >= SM.getExpansionColumnNumber(Loc) &&
          "position in file is before column number?");
 
   Optional<MemoryBufferRef> Buf = SM.getBufferOrNone(LocInfo.first);


Index: clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
@@ -158,7 +158,7 @@
   assert(!Loc.isInvalid() && "invalid Loc when adjusting column position");
 
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedExpansionLoc(Loc);
-  assert(LocInfo.second > SM.getExpansionColumnNumber(Loc) &&
+  assert(LocInfo.second + 1 >= SM.getExpansionColumnNumber(Loc) &&
          "position in file is before column number?");
 
   Optional<MemoryBufferRef> Buf = SM.getBufferOrNone(LocInfo.first);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to