diff options
author | Fangrui Song <maskray@google.com> | 2020-07-23 19:13:16 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-07-23 19:15:35 -0700 |
commit | d054c7ee2e9f4f98af7f22a5b00a941eb919bd59 (patch) | |
tree | 6a2b04f5865f59f25f172668ac59457e505f6cdc /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp | |
parent | 8131e190647ac2b5b085b48a6e3b48c1d7520a66 (diff) | |
download | llvm-d054c7ee2e9f4f98af7f22a5b00a941eb919bd59.zip llvm-d054c7ee2e9f4f98af7f22a5b00a941eb919bd59.tar.gz llvm-d054c7ee2e9f4f98af7f22a5b00a941eb919bd59.tar.bz2 |
Add test utility 'extract'
See https://lists.llvm.org/pipermail/llvm-dev/2020-July/143373.html
"[llvm-dev] Multiple documents in one test file" for some discussions.
`extract part filename` splits the input file into multiple parts separated by
regex `^(.|//)--- ` and extract the specified part to stdout or the
output file (if specified).
Use case A (organizing input of different formats (e.g. linker
script+assembly) in one file).
```
// RUN: extract lds %s -o %t.lds
// RUN: extract asm %s -o %t.s
// RUN: llvm-mc %t.s -o %t.o
// RUN: ld.lld -T %t.lds %t.o -o %t
This is sometimes better than the %S/Inputs/ approach because the user
can see the auxiliary files immediately and don't have to open another file.
```
Use case B (for utilities which don't have built-in input splitting
feature):
```
// RUN: extract case1 %s | llc | FileCheck %s --check-prefix=CASE1
// RUN: extract case2 %s | llc | FileCheck %s --check-prefix=CASE2
Combing tests prudently can improve readability.
This is sometimes better than having multiple test files.
```
Since this is a new utility, there is no git history concerns for
UpperCase variable names. I use lowerCase variable names like mlir/lld.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D83834
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
0 files changed, 0 insertions, 0 deletions