aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2022-08-22 00:30:28 +0700
committerSerge Pavlov <sepavloff@gmail.com>2022-09-29 19:15:01 +0700
commitb934be2c059a99351d08069bb80155e49f047b6e (patch)
tree33588e73b76d19fa692c7b8615837b68855a93fd /clang/lib/Driver/Driver.cpp
parente095c3ed7c26df8c6e95b616549c30099964a3ae (diff)
downloadllvm-b934be2c059a99351d08069bb80155e49f047b6e.zip
llvm-b934be2c059a99351d08069bb80155e49f047b6e.tar.gz
llvm-b934be2c059a99351d08069bb80155e49f047b6e.tar.bz2
[Support] Class for response file expansion (NFC)
Functions that implement expansion of response and config files depend on many options, which are passes as arguments. Extending the expansion requires new options, it in turn causes changing calls in various places making them even more bulky. This change introduces a class ExpansionContext, which represents set of options that control the expansion. Its methods implements expansion of responce files including config files. It makes extending the expansion easier. No functional changes. Differential Revision: https://reviews.llvm.org/D132379
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a40a992..f2ae25d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -956,7 +956,9 @@ static void appendOneArg(InputArgList &Args, const Arg *Opt,
bool Driver::readConfigFile(StringRef FileName) {
// Try reading the given file.
SmallVector<const char *, 32> NewCfgArgs;
- if (!llvm::cl::readConfigFile(FileName, Saver, NewCfgArgs, getVFS())) {
+ llvm::cl::ExpansionContext ExpCtx(Alloc, llvm::cl::tokenizeConfigFile);
+ ExpCtx.setVFS(&getVFS());
+ if (!ExpCtx.readConfigFile(FileName, NewCfgArgs)) {
Diag(diag::err_drv_cannot_read_config_file) << FileName;
return true;
}