[PATCH] Improve debug message of the layout pass.

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Oct 17 19:27:48 PDT 2013


  other than these comments, it LGTM.


================
Comment at: lib/Passes/LayoutPass.cpp:40-42
@@ -30,5 +39,5 @@
 /// f) Sorts atoms on how they appear within the File
-bool LayoutPass::CompareAtoms::operator()(const DefinedAtom *left,
-                                          const DefinedAtom *right) const {
-  DEBUG(llvm::dbgs() << "Sorting " << left->name() << " " << right->name() << "\n");
-  if (left == right)
+bool LayoutPass::CompareAtoms::compare(
+    const DefinedAtom *left, const DefinedAtom *right, std::string &reason)
+    const {
+  if (left == right) {
----------------
Looks like the prototype became unreadable now. can we use the prototype like earlier ?

================
Comment at: lib/Passes/LayoutPass.cpp:127
@@ +126,3 @@
+  DEBUG({
+    StringRef comp = result ? "<" : ">";
+    llvm::dbgs() << "Layout: '" << left->name() << "' " << comp << " '" << right->name()
----------------
equal atoms also would be shown as > ?

================
Comment at: lib/Passes/LayoutPass.cpp:125
@@ +124,3 @@
+  std::string reason;
+  bool result = compare(left, right, reason);
+  DEBUG({
----------------
could result be a pair of <StringRef, bool> or <StringRef, enum> ?


http://llvm-reviews.chandlerc.com/D1964



More information about the llvm-commits mailing list