[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu May 29 20:29:52 PDT 2025


================
@@ -0,0 +1,29 @@
+/// Invalid output path (%t is a file, not a directory).
+// RUN: rm -rf %t && touch %t
+// RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck %s
+// CHECK: clang-doc error:
+// CHECK: {{(Not a directory|no such file or directory)}}
+
+/// Invalid format option.
+// RUN: not clang-doc %s --output=%t.dir -format=badformat 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
----------------
ilovepi wrote:

If you're going to use %t.dir, you have to `rm -rf %t.dir` at the top of the test. Alternativly, you can rewrite the preamble to make things easier

```
RUN: rm -rf %t && mkdir %t && touch %t/file
```
Then in the checks you can use %t/file if you need a dir that isn't a dir.

https://github.com/llvm/llvm-project/pull/141699


More information about the cfe-commits mailing list