[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 13:49:46 PST 2020
rnk created this revision.
rnk added reviewers: MaskRay, thakis, hans.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
This behavior appears to have changed unintentionally in
b0e979724f2679e4e6f5b824144ea89289bd6d56 <https://reviews.llvm.org/rGb0e979724f2679e4e6f5b824144ea89289bd6d56>.
Instead of printing the leading newline in printFunction, print it when
printing a module. This ensures that `OS << *Func` starts printing
immediately on the current line, but whole modules are printed nicely.
Repository:
rG LLVM Github Monorepo
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.240674.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200127/572f73eb/attachment.bin>
More information about the llvm-commits
mailing list