[PATCH] D129548: [clang][dataflow] Generate readable form of input and output of satisfiability checking for debugging purposes.

weiyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 11:44:12 PDT 2022


wyt added a comment.





================
Comment at: clang/lib/Analysis/FlowSensitive/DebugSupport.cpp:119-133
+    std::vector<std::pair<std::string, std::string>> LinesData;
+    for (auto &AtomAssignment : AtomAssignments) {
+      auto Name = getAtomName(AtomAssignment.first);
+      MaxNameLength = std::max(MaxNameLength, Name.size());
+      LinesData.push_back({Name, debugString(AtomAssignment.second)});
+    }
+    llvm::sort(LinesData.begin(), LinesData.end());
----------------
xazax.hun wrote:
> In its current form, I think you could create the final strings in one step and sort those strings instead of the pairs. Or do we expect alignment to mess up the order in that case?
> In its current form, I think you could create the final strings in one step and sort those strings instead of the pairs. Or do we expect alignment to mess up the order in that case?

Removed `LinesData` and the intermediate step of storing a pair of strings. There is still a loop at the start of the function to find the max name length for alignment purposes. 


================
Comment at: clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp:230
+------------
+Unsatisfiable.
+
----------------
@xazax.hun 
> I don't see a test case for `Unsatisfiable` constraints.
Here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129548



More information about the cfe-commits mailing list