Skip to content

Conversation

@ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Jun 3, 2025

Instead of having a platform specific error diagnostic, use a fixed one
with more direct context for the error.

Instead of having a platform specific error diagnostic, use a fixed one
with more direct context for the error.
Copy link
Contributor Author

ilovepi commented Jun 3, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

Changes

Instead of having a platform specific error diagnostic, use a fixed one
with more direct context for the error.


Full diff: https://github.com/llvm/llvm-project/pull/142665.diff

2 Files Affected:

  • (modified) clang-tools-extra/clang-doc/tool/ClangDocMain.cpp (+2-1)
  • (modified) clang-tools-extra/test/clang-doc/invalid-options.cpp (+1-1)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 0d2415c619217..15de031aa6091 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -267,7 +267,8 @@ static llvm::Error handleMappingFailures(llvm::Error Err) {
 
 static llvm::Error createDirectories(llvm::StringRef OutDirectory) {
   if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory))
-    return llvm::createFileError(OutDirectory, Err);
+    return llvm::createFileError(OutDirectory, Err,
+                                 "failed to create directory.");
   return llvm::Error::success();
 }
 
diff --git a/clang-tools-extra/test/clang-doc/invalid-options.cpp b/clang-tools-extra/test/clang-doc/invalid-options.cpp
index 59a0944718e31..15e098ad4c784 100644
--- a/clang-tools-extra/test/clang-doc/invalid-options.cpp
+++ b/clang-tools-extra/test/clang-doc/invalid-options.cpp
@@ -2,7 +2,7 @@
 // RUN: rm -rf %t && touch %t
 // RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck %s --check-prefix=OUTPUT-FAIL
 // OUTPUT-FAIL: clang-doc error:
-// OUTPUT-FAIL: {{(Not a directory|[Nn]o such file or directory)}}
+// OUTPUT-FAIL-SAME: failed to create directory.
 
 /// Invalid format option.
 // RUN: rm -rf %t && mkdir %t && touch %t/file

@ilovepi ilovepi requested a review from mstorsjo June 3, 2025 20:14
Copy link
Contributor Author

ilovepi commented Jun 4, 2025

Merge activity

  • Jun 4, 4:45 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 4, 4:47 PM UTC: @ilovepi merged this pull request with Graphite.

@ilovepi ilovepi merged commit 89cea0d into main Jun 4, 2025
13 checks passed
@ilovepi ilovepi deleted the users/ilovepi/clang-doc-brittle-test branch June 4, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants