aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2022-10-14 20:07:09 +0700
committerSerge Pavlov <sepavloff@gmail.com>2022-10-29 22:01:47 +0700
commit17eb198de934eced784e16ec15e020a574ba07e1 (patch)
treebf58a5eb0a64bf65e32f77ef3b7e4781edaeb9da /clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
parentd344146857aa105a24e06f2526d88e96c5865d00 (diff)
downloadllvm-17eb198de934eced784e16ec15e020a574ba07e1.zip
llvm-17eb198de934eced784e16ec15e020a574ba07e1.tar.gz
llvm-17eb198de934eced784e16ec15e020a574ba07e1.tar.bz2
Handle errors in expansion of response files
Previously an error raised during an expansion of response files (including configuration files) was ignored and only the fact of its presence was reported to the user with generic error messages. This made it difficult to analyze problems. For example, if a configuration file tried to read an inexistent file, the error message said that 'configuration file cannot be found', which is wrong and misleading. This change enhances handling errors in the expansion so that users could get more informative error messages. Differential Revision: https://reviews.llvm.org/D136090
Diffstat (limited to 'clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp')
-rw-r--r--clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
index c4b3abc..88d20ba 100644
--- a/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
+++ b/clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
@@ -61,9 +61,11 @@ private:
continue;
llvm::BumpPtrAllocator Alloc;
llvm::cl::ExpansionContext ECtx(Alloc, Tokenizer);
- ECtx.setVFS(FS.get())
- .setCurrentDir(Cmd.Directory)
- .expandResponseFiles(Argv);
+ llvm::Error Err = ECtx.setVFS(FS.get())
+ .setCurrentDir(Cmd.Directory)
+ .expandResponseFiles(Argv);
+ if (Err)
+ llvm::errs() << Err;
// Don't assign directly, Argv aliases CommandLine.
std::vector<std::string> ExpandedArgv(Argv.begin(), Argv.end());
Cmd.CommandLine = std::move(ExpandedArgv);