#define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_
#include "clang/Basic/LangOptions.h"
+#include "clang/Frontend/CompileOptions.h"
#include "clang/Frontend/DiagnosticOptions.h"
#include "clang/Frontend/HeaderSearchOptions.h"
#include "clang/Frontend/PreprocessorOptions.h"
/// compiler, including data such as the include paths, the code generation
/// options, the warning flags, and so on.
class CompilerInvocation {
- /// The location for the output file. This is optional only for compiler
- /// invocations which have no output.
- std::string OutputFile;
+ /// Options controlling IRgen and the backend.
+ CompileOptions CompileOpts;
/// Options controlling the diagnostic engine.
DiagnosticOptions DiagOpts;
/// Options controlling the preprocessor (aside from #include handling).
PreprocessorOptions PreprocessorOpts;
+ /// The location for the output file. This is optional only for compiler
+ /// invocations which have no output.
+ std::string OutputFile;
+
/// Set of target-specific code generation features to enable/disable.
llvm::StringMap<bool> TargetFeatures;
public:
CompilerInvocation() {}
+ /// @name Invidual Options
+ /// @{
+
std::string &getOutputFile() { return OutputFile; }
const std::string &getOutputFile() const { return OutputFile; }
+ llvm::StringMap<bool> &getTargetFeatures() { return TargetFeatures; }
+ const llvm::StringMap<bool> &getTargetFeatures() const {
+ return TargetFeatures;
+ }
+
+ /// @}
+ /// @name Option Subgroups
+ /// @{
+
+ CompileOptions &getCompileOpts() { return CompileOpts; }
+ const CompileOptions &getCompileOpts() const {
+ return CompileOpts;
+ }
+
DiagnosticOptions &getDiagnosticOpts() { return DiagOpts; }
const DiagnosticOptions &getDiagnosticOpts() const { return DiagOpts; }
return PreprocessorOpts;
}
- llvm::StringMap<bool> &getTargetFeatures() { return TargetFeatures; }
- const llvm::StringMap<bool> &getTargetFeatures() const {
- return TargetFeatures;
- }
+ /// @}
};
} // end namespace clang
Opts.Inlining = CompileOptions::OnlyAlwaysInlining;
}
- // FIXME: There are llvm-gcc options to control these selectively.
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
Opts.SimplifyLibCalls = !LangOpts.NoBuiltin;
Opts.DisableRedZone = DisableRedZone;
Opts.NoImplicitFloat = NoImplicitFloat;
-
+
Opts.MergeAllConstants = !NoMergeConstants;
}
OS.reset(ComputeOutFile(CompOpts, InFile, "bc", true, OutPath));
}
- CompileOptions Opts;
- InitializeCompileOptions(Opts, PP.getLangOptions(),
- CompOpts.getTargetFeatures());
return CreateBackendConsumer(Act, PP.getDiagnostics(), PP.getLangOptions(),
- Opts, InFile, OS.get(), Context);
+ CompOpts.getCompileOpts(), InFile, OS.get(),
+ Context);
}
case RewriteObjC:
// Compute the feature set, which may effect the language.
ComputeFeatureMap(Target, Opts.getTargetFeatures());
-
+
// Initialize language options.
LangOptions LangInfo;
-
+
// FIXME: These aren't used during operations on ASTs. Split onto a separate
// code path to make this obvious.
if (LK != langkind_ast) {
// Initialize the other preprocessor options.
InitializePreprocessorOptions(Opts.getPreprocessorOpts());
+
+ // Initialize backend options.
+ InitializeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts(),
+ Opts.getTargetFeatures());
}
int main(int argc, char **argv) {