Clang error: unable to open output file 'A': 'B' (err_fe_unable_to_open_output)
Jump to navigation
Jump to search
Text | error: unable to open output file 'A': 'B' |
---|---|
Type | Error |
Category | None |
Internal Id | err_fe_unable_to_open_output |
Internal Message | unable to open output file '%0': '%1'
|
Regular Expression | (?:error|fatal error)\: unable to open output file '(.*?)'\: '(.*?)'
|
First Commit | 2009-12-03 7554699afabf Fix CompilerInstance::createOutputFile to use proper diagnostics, and (try to) update all clients to... |
Description
Example
Flags | -xc++ -o /nonexistent/nonexistent.o
|
|
---|---|---|
Source |
int main() {}
// Will fail due to non-existent output directory
| |
Compiler Output |
error: unable to open output file '/nonexistent/nonexistent.o': 'No such file or directory' |
Clang Internals (17.0.6)
Git Commit Message
Fix CompilerInstance::createOutputFile to use proper diagnostics, and (try to) update all clients to be able to handle failure. llvm-svn: 90437
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/CodeGen/BackendUtil.cpp (line 150)
class EmitAssemblyHelper {
// ...
std::unique_ptr<llvm::ToolOutputFile> openOutputFile(StringRef Path) {
// ...
if (EC) {
Diags.Report(diag::err_fe_unable_to_open_output) << Path << EC.message();
clang/lib/Frontend/CompilerInstance.cpp (line 838)
std::unique_ptr<raw_pwrite_stream> CompilerInstance::createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, bool UseTemporary, bool CreateMissingDirectories) {
// ...
getDiagnostics().Report(diag::err_fe_unable_to_open_output) << OutputPath << errorToErrorCode(OS.takeError()).message();
clang/lib/Frontend/CompilerInstance.cpp (line 2164)
void CompilerInstance::createModuleFromSource(SourceLocation ImportLoc, StringRef ModuleName, StringRef Source) {
// ...
if (std::error_code EC = llvm::sys::fs::createTemporaryFile(CleanModuleName, "pcm", ModuleFileName)) {
getDiagnostics().Report(ImportLoc, diag::err_fe_unable_to_open_output) << ModuleFileName << EC.message();
clang/lib/Frontend/Rewrite/FixItRewriter.cpp (line 108)
bool FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::string, std::string>> *RewrittenFiles) {
// ...
for (iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) {
// ...
if (EC) {
Diags.Report(clang::diag::err_fe_unable_to_open_output) << Filename << EC.message();
clang/tools/driver/cc1as_main.cpp (line 376)
static std::unique_ptr<raw_fd_ostream> getOutputStream(StringRef Path, DiagnosticsEngine &Diags, bool Binary) {
// ...
if (EC) {
Diags.Report(diag::err_fe_unable_to_open_output) << Path << EC.message();
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Driver/ftime-trace.cpp
- error: unable to open output file '/dev/null.json': 'Permission denied'