summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2010-11-20 01:09:01 -0500
committerZack Rusin <zack@kde.org>2010-11-20 01:09:01 -0500
commitb3a2e1ab965180d07fc75000a9a40d1b90740621 (patch)
treeb35438bcc9f68f459dccc6886848279861755c1f
parentd6fc4e77c7fb35aa4a225000a3bf923ecb48b903 (diff)
Various fixes.
-rw-r--r--src/compiler/compiler.cpp69
1 files changed, 41 insertions, 28 deletions
diff --git a/src/compiler/compiler.cpp b/src/compiler/compiler.cpp
index c0c0338..3a52843 100644
--- a/src/compiler/compiler.cpp
+++ b/src/compiler/compiler.cpp
@@ -24,33 +24,6 @@
using namespace Coal;
using namespace clang;
-
-static void
-setupHeaderSearchOpts(HeaderSearchOptions &opts)
-{
- opts.Verbose = true;
- opts.UseBuiltinIncludes = false;
- opts.UseStandardIncludes = false;
- opts.UseStandardCXXIncludes = false;
-
- std::string buildPath(COAL_BUILD_DIR);
- buildPath += "src/builtin";
- opts.AddPath(buildPath,
- frontend::Angled, true,
- /*IsFramework=*/ false, true);
- std::string installPath(COAL_INSTALL_DIR);
- installPath += "include/coal";
- opts.AddPath(installPath,
- frontend::Angled, true,
- /*IsFramework=*/ false, true);
-}
-
-static void
-setupPreprocessorOpts(PreprocessorOptions &opts)
-{
- opts.Includes.push_back("coal-internal.h");
-}
-
static void
setupCodeGenOpts(CodeGenOptions &opts)
{
@@ -78,12 +51,50 @@ static void
setupFrontendOpts(FrontendOptions &opts)
{
opts.ProgramAction = frontend::EmitLLVMOnly;
- opts.ShowVersion = true;
opts.DisableFree = true;
opts.Inputs.push_back(
std::make_pair(IK_OpenCL, "-"));
}
+static void
+setupHeaderSearchOpts(HeaderSearchOptions &opts)
+{
+ opts.Verbose = true;
+ opts.UseBuiltinIncludes = false;
+ opts.UseStandardIncludes = false;
+ opts.UseStandardCXXIncludes = false;
+
+ std::string buildPath(COAL_BUILD_DIR);
+ buildPath += "/src/builtins";
+ opts.AddPath(buildPath,
+ frontend::Angled, true,
+ /*IsFramework=*/ false, true);
+ std::string installPath(COAL_INSTALL_DIR);
+ installPath += "/include/coal";
+ opts.AddPath(installPath,
+ frontend::Angled, true,
+ /*IsFramework=*/ false, true);
+}
+
+static void
+setupLangOpts(LangOptions &opts)
+{
+ opts.NoBuiltin = true;
+}
+
+static void
+setupPreprocessorOpts(PreprocessorOptions &opts)
+{
+ opts.Includes.push_back("coal-internal.h");
+}
+
+static void
+setupTargetOpts(TargetOptions &opts)
+{
+ opts.Triple = llvm::sys::getHostTriple();
+ //opts.CPU =
+}
+
Compiler::Compiler()
{
@@ -109,6 +120,8 @@ bool Compiler::init()
setupCodeGenOpts(m_clang.getCodeGenOpts());
setupDiagnosticOpts(m_clang.getDiagnosticOpts());
setupFrontendOpts(m_clang.getFrontendOpts());
+ setupLangOpts(m_clang.getLangOpts());
+ setupTargetOpts(m_clang.getTargetOpts());
}
llvm::Module * Compiler::compile(const std::string &text)