[cfe-commits] r86685 - in /cfe/trunk: include/clang/Frontend/CompilerInvocation.h tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 10 08:19:45 PST 2009
Author: ddunbar
Date: Tue Nov 10 10:19:45 2009
New Revision: 86685
URL: http://llvm.org/viewvc/llvm-project?rev=86685&view=rev
Log:
Add CompileOptions to CompilerInvocation.
Modified:
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=86685&r1=86684&r2=86685&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Tue Nov 10 10:19:45 2009
@@ -11,6 +11,7 @@
#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"
@@ -26,9 +27,8 @@
/// 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;
@@ -42,15 +42,36 @@
/// 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; }
@@ -67,10 +88,7 @@
return PreprocessorOpts;
}
- llvm::StringMap<bool> &getTargetFeatures() { return TargetFeatures; }
- const llvm::StringMap<bool> &getTargetFeatures() const {
- return TargetFeatures;
- }
+ /// @}
};
} // end namespace clang
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86685&r1=86684&r2=86685&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Tue Nov 10 10:19:45 2009
@@ -1330,7 +1330,6 @@
Opts.Inlining = CompileOptions::OnlyAlwaysInlining;
}
- // FIXME: There are llvm-gcc options to control these selectively.
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
Opts.SimplifyLibCalls = !LangOpts.NoBuiltin;
@@ -1356,7 +1355,7 @@
Opts.DisableRedZone = DisableRedZone;
Opts.NoImplicitFloat = NoImplicitFloat;
-
+
Opts.MergeAllConstants = !NoMergeConstants;
}
@@ -1692,11 +1691,9 @@
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:
@@ -2177,10 +2174,10 @@
// 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) {
@@ -2194,6 +2191,10 @@
// Initialize the other preprocessor options.
InitializePreprocessorOptions(Opts.getPreprocessorOpts());
+
+ // Initialize backend options.
+ InitializeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts(),
+ Opts.getTargetFeatures());
}
int main(int argc, char **argv) {
More information about the cfe-commits
mailing list