[PATCH] D73505: [IR] Keep a double break between function decls and defs

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 15:32:57 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9521c18438a9: [IR] Keep a double break between functions when printing a module (authored by rnk).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73505

Files:
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Feature/undefined.ll


Index: llvm/test/Feature/undefined.ll
===================================================================
--- llvm/test/Feature/undefined.ll
+++ llvm/test/Feature/undefined.ll
@@ -1,6 +1,7 @@
 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
 ; RUN: diff %t1.ll %t2.ll
+; RUN: FileCheck %s < %t1.ll
 
 @X = global i32 undef           ; <i32*> [#uses=0]
 
@@ -15,3 +16,15 @@
         ret i32 %X
 }
 
+
+; Check that there is a newline between functions.
+
+; CHECK: @X = global
+; CHECK-EMPTY:
+; CHECK: declare i32 @atoi(i8*)
+; CHECK-EMPTY:
+; CHECK: define i32 @test() {
+; CHECK: {{^[}]}}
+; CHECK-EMPTY:
+; CHECK: define i32 @test2() {
+; CHECK: {{^[}]}}
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -2651,8 +2651,10 @@
   printUseLists(nullptr);
 
   // Output all of the functions.
-  for (const Function &F : *M)
+  for (const Function &F : *M) {
+    Out << '\n';
     printFunction(&F);
+  }
   assert(UseListOrders.empty() && "All use-lists should have been consumed");
 
   // Output all attribute groups.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73505.240704.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200127/7877a0a0/attachment.bin>


More information about the llvm-commits mailing list