[PATCH] D134813: Properly print unnamed TagDecl objects in diagnostics

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 09:28:44 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/ExtractAPI/enum.c:3
 // RUN: split-file %s %t
-// RUN: sed -e "s at INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: sed -e "s at INPUT_FILE@%/et/input.h at g" -e "s at INPUT_DIR@%{/t:regex_replacement}@g" \
 // RUN: %t/reference.output.json.in >> %t/reference.output.json
----------------
This test's use of `diff` makes the diagnostic changes rather challenging. We can't diff the file path that's included when printing an unnamed object, because that path may be different from machine to machine. `diff` doesn't have any wildcard matching functionality to help here either. So we use `sed` to mutate the test file.. but the output uses the path of `%t` with escapes and we don't have a sed-compatible way to do that on Windows.

e.g., the output we want to match will contain `F:\\users\\aballman\\desktop\\test.c` on Windows but `%t` gives `F:\users\aballman\desktop\test.c` which sed turns into `F:sers ballman esktop est.c` or some other garbled form.

I'm hoping someone has a better way to approach this. I added `%/et` (for escaped %t) to get the behavior I needed, but I'd prefer not to modify lit for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134813



More information about the cfe-commits mailing list