summaryrefslogtreecommitdiff
path: root/include/clang/Driver/Driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Driver/Driver.h')
-rw-r--r--include/clang/Driver/Driver.h45
1 files changed, 37 insertions, 8 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index a3662872a9..0713430983 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -19,6 +19,8 @@
#include "clang/Driver/Util.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/StringSaver.h"
#include <list>
#include <map>
@@ -26,14 +28,6 @@
namespace llvm {
class Triple;
-
-namespace opt {
- class Arg;
- class ArgList;
- class DerivedArgList;
- class InputArgList;
- class OptTable;
-}
}
namespace clang {
@@ -138,6 +132,12 @@ public:
/// The path to the compiler resource directory.
std::string ResourceDir;
+ /// System directory for config files.
+ std::string SystemConfigDir;
+
+ /// User directory for config files.
+ std::string UserConfigDir;
+
/// A prefix directory used to emulate a limited subset of GCC's '-Bprefix'
/// functionality.
/// FIXME: This type of customization should be removed in favor of the
@@ -208,6 +208,21 @@ private:
/// Name to use when invoking gcc/g++.
std::string CCCGenericGCCName;
+ /// Name of configuration file if used.
+ std::string ConfigFile;
+
+ /// Allocator for string saver.
+ llvm::BumpPtrAllocator Alloc;
+
+ /// Object that stores strings read from configuration file.
+ llvm::StringSaver Saver;
+
+ /// Arguments originated from configuration file.
+ std::unique_ptr<llvm::opt::InputArgList> CfgOptions;
+
+ /// Arguments originated from command line.
+ std::unique_ptr<llvm::opt::InputArgList> CLOptions;
+
/// Whether to check that input files exist when constructing compilation
/// jobs.
unsigned CheckInputsExist : 1;
@@ -277,6 +292,8 @@ public:
/// Name to use when invoking gcc/g++.
const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
+ const std::string &getConfigFile() const { return ConfigFile; }
+
const llvm::opt::OptTable &getOpts() const { return *Opts; }
const DiagnosticsEngine &getDiags() const { return Diags; }
@@ -493,6 +510,18 @@ public:
LTOKind getLTOMode() const { return LTOMode; }
private:
+
+ /// Tries to load options from configuration file.
+ ///
+ /// \returns true if error occurred.
+ bool loadConfigFile();
+
+ /// Read options from the specified file.
+ ///
+ /// \param [in] FileName File to read.
+ /// \returns true, if error occurred while reading.
+ bool readConfigFile(StringRef FileName);
+
/// Set the driver mode (cl, gcc, etc) from an option string of the form
/// --driver-mode=<mode>.
void setDriverModeFromOption(StringRef Opt);