[PATCH] D65953: [llvm-readelf]Print filename for multiple inputs and fix formatting regression

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 02:31:35 PDT 2019


jhenderson marked an inline comment as done.
jhenderson added inline comments.


================
Comment at: test/tools/llvm-readobj/file-name.test:28
+## The very first line should be blank. CHECK-EMPTY isn't allowed on the first line.
+# NAME1:      {{^}}
+# NAME1-NOT:  {{.}}
----------------
MaskRay wrote:
> To test the first line is blank: `# NAME1: {{^$}}`
> 
> This is what readelf does (since its initial import in 1999):
> ```
>   /* Process the file.  */
>   if (show_name)
>     printf (_("\nFile: %s\n"), filedata->file_name);
> ```
> 
> I think the blank line is pretty arbitrary. It is there just because it was easy to implement...
I agree that the line is arbitrary. Unfortunately, I've noticed a local parsing script that relies on it in some cases, so I'd be surprised if there aren't others out there doing the same thing.

> To test the first line is blank: # NAME1: {{^$}}

I knew that somebody would comment on this :)

I was just typing out this response, when I realised that we don't need the added complexity: 

> All your suggested pattern does is test that there is an empty line somewhere in the input (and that later checks follow it). It doesn't guarantee it's the first line. Just as we want one empty line at the start, we also don't want 2+

I realised however that FileCheck ensures that the first check matches the first line, and then the CHECK-NEXT matches the next, so it can't be an arbitrary location. I'll update the test before committing.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65953





More information about the llvm-commits mailing list