aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-02-19 21:39:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-02-19 21:39:31 +0000
commit96b1d4b4eb6b18dd6df7a2c0833332b45840580f (patch)
tree5c389038723168572e7e35c9f10d3460ad7354ca
parentb20f5c6f79968ce57ebb6222f0d2e7f51908d1be (diff)
Revert 125820 and 125819 to fix PR9266.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126050 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--examples/PrintFunctionNames/CMakeLists.txt25
-rw-r--r--examples/clang-interpreter/main.cpp2
-rw-r--r--include/clang/Basic/TargetInfo.h8
-rw-r--r--include/clang/CodeGen/CodeGenAction.h23
-rw-r--r--include/clang/Frontend/ASTConsumers.h2
-rw-r--r--include/clang/Frontend/CompilerInstance.h21
-rw-r--r--lib/Basic/Targets.cpp12
-rw-r--r--lib/CodeGen/CGStmt.cpp9
-rw-r--r--lib/CodeGen/CodeGenAction.cpp40
-rw-r--r--lib/CodeGen/TargetInfo.cpp22
-rw-r--r--lib/CodeGen/TargetInfo.h9
-rw-r--r--lib/Frontend/CompilerInstance.cpp5
-rw-r--r--tools/c-index-test/CMakeLists.txt3
-rw-r--r--tools/c-index-test/Makefile2
-rw-r--r--tools/driver/cc1_main.cpp3
-rw-r--r--tools/libclang/CMakeLists.txt3
-rw-r--r--tools/libclang/Makefile2
-rw-r--r--unittests/Basic/Makefile2
-rw-r--r--unittests/Frontend/FrontendActionTest.cpp2
-rw-r--r--unittests/Frontend/Makefile2
20 files changed, 110 insertions, 87 deletions
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
index 86793ce7e1..58b4603e9b 100644
--- a/examples/PrintFunctionNames/CMakeLists.txt
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -1,11 +1,34 @@
set(MODULE TRUE)
set( LLVM_USED_LIBS
+ clangFrontendTool
clangFrontend
+ clangDriver
+ clangSerialization
+ clangCodeGen
+ clangParse
+ clangSema
+ clangStaticAnalyzerFrontend
+ clangStaticAnalyzerCheckers
+ clangStaticAnalyzerCore
+ clangAnalysis
+ clangIndex
+ clangRewrite
clangAST
+ clangLex
+ clangBasic
)
-set( LLVM_LINK_COMPONENTS support mc)
+# Why do we have to link to all this just to print out function names?
+set( LLVM_LINK_COMPONENTS
+ ${LLVM_TARGETS_TO_BUILD}
+ asmparser
+ bitreader
+ bitwriter
+ codegen
+ ipo
+ selectiondag
+ )
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp
index a99766f9a3..835a5a90ad 100644
--- a/examples/clang-interpreter/main.cpp
+++ b/examples/clang-interpreter/main.cpp
@@ -17,6 +17,7 @@
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Config/config.h"
#include "llvm/ADT/OwningPtr.h"
@@ -129,6 +130,7 @@ int main(int argc, const char **argv, char * const *envp) {
// Create a compiler instance to handle the actual work.
CompilerInstance Clang;
+ Clang.setLLVMContext(new llvm::LLVMContext);
Clang.setInvocation(CI.take());
// Create the compilers actual diagnostics engine.
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index b9087f2c47..586680bbd0 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -26,6 +26,8 @@
namespace llvm {
struct fltSemantics;
class StringRef;
+class LLVMContext;
+class Type;
}
namespace clang {
@@ -530,6 +532,12 @@ public:
virtual const char *getStaticInitSectionSpecifier() const {
return 0;
}
+
+ virtual const llvm::Type* adjustInlineAsmType(std::string& Constraint,
+ const llvm::Type* Ty,
+ llvm::LLVMContext& Context) const {
+ return Ty;
+ }
protected:
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
return PointerWidth;
diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h
index 052c6603f5..b55effc6be 100644
--- a/include/clang/CodeGen/CodeGenAction.h
+++ b/include/clang/CodeGen/CodeGenAction.h
@@ -14,7 +14,6 @@
#include "llvm/ADT/OwningPtr.h"
namespace llvm {
- class LLVMContext;
class Module;
}
@@ -25,14 +24,9 @@ class CodeGenAction : public ASTFrontendAction {
private:
unsigned Act;
llvm::OwningPtr<llvm::Module> TheModule;
- llvm::LLVMContext *VMContext;
- bool OwnsVMContext;
protected:
- /// Create a new code generation action. If the optional \arg _VMContext
- /// parameter is supplied, the action uses it without taking ownership,
- /// otherwise it creates a fresh LLVM context and takes ownership.
- CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0);
+ CodeGenAction(unsigned _Act);
virtual bool hasIRSupport() const;
@@ -50,40 +44,37 @@ public:
/// been run. The result may be null on failure.
llvm::Module *takeModule();
- /// Take the LLVM context used by this action.
- llvm::LLVMContext *takeLLVMContext();
-
BackendConsumer *BEConsumer;
};
class EmitAssemblyAction : public CodeGenAction {
public:
- EmitAssemblyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitAssemblyAction();
};
class EmitBCAction : public CodeGenAction {
public:
- EmitBCAction(llvm::LLVMContext *_VMContext = 0);
+ EmitBCAction();
};
class EmitLLVMAction : public CodeGenAction {
public:
- EmitLLVMAction(llvm::LLVMContext *_VMContext = 0);
+ EmitLLVMAction();
};
class EmitLLVMOnlyAction : public CodeGenAction {
public:
- EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitLLVMOnlyAction();
};
class EmitCodeGenOnlyAction : public CodeGenAction {
public:
- EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitCodeGenOnlyAction();
};
class EmitObjAction : public CodeGenAction {
public:
- EmitObjAction(llvm::LLVMContext *_VMContext = 0);
+ EmitObjAction();
};
}
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index c45bd40706..e2071df8e3 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -18,6 +18,8 @@
namespace llvm {
class raw_ostream;
+ class Module;
+ class LLVMContext;
namespace sys { class Path; }
}
namespace clang {
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 7ea79e5599..430cc603c7 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -19,6 +19,7 @@
#include <string>
namespace llvm {
+class LLVMContext;
class raw_ostream;
class raw_fd_ostream;
class Timer;
@@ -58,6 +59,9 @@ class TargetInfo;
/// come in two forms; a short form that reuses the CompilerInstance objects,
/// and a long form that takes explicit instances of any required objects.
class CompilerInstance {
+ /// The LLVM context used for this instance.
+ llvm::OwningPtr<llvm::LLVMContext> LLVMContext;
+
/// The options used in this compiler instance.
llvm::OwningPtr<CompilerInvocation> Invocation;
@@ -151,6 +155,23 @@ public:
bool ExecuteAction(FrontendAction &Act);
/// }
+ /// @name LLVM Context
+ /// {
+
+ bool hasLLVMContext() const { return LLVMContext != 0; }
+
+ llvm::LLVMContext &getLLVMContext() const {
+ assert(LLVMContext && "Compiler instance has no LLVM context!");
+ return *LLVMContext;
+ }
+
+ llvm::LLVMContext *takeLLVMContext() { return LLVMContext.take(); }
+
+ /// setLLVMContext - Replace the current LLVM context and take ownership of
+ /// \arg Value.
+ void setLLVMContext(llvm::LLVMContext *Value);
+
+ /// }
/// @name Compiler Invocation and Options
/// {
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index a8198e4ae7..b3501a31c8 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1014,6 +1014,9 @@ public:
}
virtual bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const;
+ virtual const llvm::Type* adjustInlineAsmType(std::string& Constraint,
+ const llvm::Type* Ty,
+ llvm::LLVMContext& Context) const;
virtual std::string convertConstraint(const char Constraint) const;
virtual const char *getClobbers() const {
return "~{dirflag},~{fpsr},~{flags}";
@@ -1338,6 +1341,15 @@ X86TargetInfo::validateAsmConstraint(const char *&Name,
return false;
}
+const llvm::Type*
+X86TargetInfo::adjustInlineAsmType(std::string& Constraint,
+ const llvm::Type* Ty,
+ llvm::LLVMContext &Context) const {
+ if (Constraint=="y" && Ty->isVectorTy())
+ return llvm::Type::getX86_MMXTy(Context);
+ return Ty;
+}
+
std::string
X86TargetInfo::convertConstraint(const char Constraint) const {
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index cd238112ed..f809c009ce 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -14,7 +14,6 @@
#include "CGDebugInfo.h"
#include "CodeGenModule.h"
#include "CodeGenFunction.h"
-#include "TargetInfo.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/PrettyStackTrace.h"
#include "clang/Basic/TargetInfo.h"
@@ -1136,8 +1135,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
}
}
if (const llvm::Type* AdjTy =
- getTargetHooks().adjustInlineAsmType(*this, OutputConstraint,
- ResultRegTypes.back()))
+ Target.adjustInlineAsmType(OutputConstraint, ResultRegTypes.back(),
+ getLLVMContext()))
ResultRegTypes.back() = AdjTy;
} else {
ArgTypes.push_back(Dest.getAddress()->getType());
@@ -1208,8 +1207,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
}
}
if (const llvm::Type* AdjTy =
- getTargetHooks().adjustInlineAsmType(*this, InputConstraint,
- Arg->getType()))
+ Target.adjustInlineAsmType(InputConstraint, Arg->getType(),
+ getLLVMContext()))
Arg = Builder.CreateBitCast(Arg, AdjTy);
ArgTypes.push_back(Arg->getType());
diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp
index a24bbc480c..69ac995a46 100644
--- a/lib/CodeGen/CodeGenAction.cpp
+++ b/lib/CodeGen/CodeGenAction.cpp
@@ -224,15 +224,9 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D,
//
-CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)
- : Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),
- OwnsVMContext(!_VMContext) {}
-
-CodeGenAction::~CodeGenAction() {
- TheModule.reset();
- if (OwnsVMContext)
- delete VMContext;
-}
+CodeGenAction::CodeGenAction(unsigned _Act) : Act(_Act) {}
+
+CodeGenAction::~CodeGenAction() {}
bool CodeGenAction::hasIRSupport() const { return true; }
@@ -249,11 +243,6 @@ llvm::Module *CodeGenAction::takeModule() {
return TheModule.take();
}
-llvm::LLVMContext *CodeGenAction::takeLLVMContext() {
- OwnsVMContext = false;
- return VMContext;
-}
-
static raw_ostream *GetOutputStream(CompilerInstance &CI,
llvm::StringRef InFile,
BackendAction Action) {
@@ -286,7 +275,7 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
new BackendConsumer(BA, CI.getDiagnostics(),
CI.getCodeGenOpts(), CI.getTargetOpts(),
CI.getFrontendOpts().ShowTimers, InFile, OS.take(),
- *VMContext);
+ CI.getLLVMContext());
return BEConsumer;
}
@@ -312,7 +301,7 @@ void CodeGenAction::ExecuteAction() {
getCurrentFile().c_str());
llvm::SMDiagnostic Err;
- TheModule.reset(ParseIR(MainFileCopy, Err, *VMContext));
+ TheModule.reset(ParseIR(MainFileCopy, Err, CI.getLLVMContext()));
if (!TheModule) {
// Translate from the diagnostic info to the SourceManager location.
SourceLocation Loc = SM.getLocation(
@@ -343,20 +332,15 @@ void CodeGenAction::ExecuteAction() {
//
-EmitAssemblyAction::EmitAssemblyAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitAssembly, _VMContext) {}
+EmitAssemblyAction::EmitAssemblyAction()
+ : CodeGenAction(Backend_EmitAssembly) {}
-EmitBCAction::EmitBCAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitBC, _VMContext) {}
+EmitBCAction::EmitBCAction() : CodeGenAction(Backend_EmitBC) {}
-EmitLLVMAction::EmitLLVMAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitLL, _VMContext) {}
+EmitLLVMAction::EmitLLVMAction() : CodeGenAction(Backend_EmitLL) {}
-EmitLLVMOnlyAction::EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitNothing, _VMContext) {}
+EmitLLVMOnlyAction::EmitLLVMOnlyAction() : CodeGenAction(Backend_EmitNothing) {}
-EmitCodeGenOnlyAction::EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitMCNull, _VMContext) {}
+EmitCodeGenOnlyAction::EmitCodeGenOnlyAction() : CodeGenAction(Backend_EmitMCNull) {}
-EmitObjAction::EmitObjAction(llvm::LLVMContext *_VMContext)
- : CodeGenAction(Backend_EmitObj, _VMContext) {}
+EmitObjAction::EmitObjAction() : CodeGenAction(Backend_EmitObj) {}
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index f95aab0744..881a7ee4d0 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -355,14 +355,6 @@ bool UseX86_MMXType(const llvm::Type *IRType) {
IRType->getScalarSizeInBits() != 64;
}
-static const llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
- llvm::StringRef Constraint,
- const llvm::Type* Ty) {
- if (Constraint=="y" && UseX86_MMXType(Ty))
- return llvm::Type::getX86_MMXTy(CGF.getLLVMContext());
- return Ty;
-}
-
//===----------------------------------------------------------------------===//
// X86-32 ABI Implementation
//===----------------------------------------------------------------------===//
@@ -423,13 +415,6 @@ public:
bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const;
-
- const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
- llvm::StringRef Constraint,
- const llvm::Type* Ty) const {
- return X86AdjustInlineAsmType(CGF, Constraint, Ty);
- }
-
};
}
@@ -910,13 +895,6 @@ public:
return false;
}
-
- const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
- llvm::StringRef Constraint,
- const llvm::Type* Ty) const {
- return X86AdjustInlineAsmType(CGF, Constraint, Ty);
- }
-
};
class WinX86_64TargetCodeGenInfo : public TargetCodeGenInfo {
diff --git a/lib/CodeGen/TargetInfo.h b/lib/CodeGen/TargetInfo.h
index 4f59eb619e..9d4cf16103 100644
--- a/lib/CodeGen/TargetInfo.h
+++ b/lib/CodeGen/TargetInfo.h
@@ -15,11 +15,8 @@
#ifndef CLANG_CODEGEN_TARGETINFO_H
#define CLANG_CODEGEN_TARGETINFO_H
-#include "llvm/ADT/StringRef.h"
-
namespace llvm {
class GlobalValue;
- class Type;
class Value;
}
@@ -105,12 +102,6 @@ namespace clang {
llvm::Value *Address) const {
return Address;
}
-
- virtual const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
- llvm::StringRef Constraint,
- const llvm::Type* Ty) const {
- return Ty;
- }
};
}
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index fd593de560..412e7111e4 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -27,6 +27,7 @@
#include "clang/Frontend/Utils.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Sema/CodeCompleteConsumer.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
@@ -46,6 +47,10 @@ CompilerInstance::CompilerInstance()
CompilerInstance::~CompilerInstance() {
}
+void CompilerInstance::setLLVMContext(llvm::LLVMContext *Value) {
+ LLVMContext.reset(Value);
+}
+
void CompilerInstance::setInvocation(CompilerInvocation *Value) {
Invocation.reset(Value);
}
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
index 45ad9e35c6..9169fc7422 100644
--- a/tools/c-index-test/CMakeLists.txt
+++ b/tools/c-index-test/CMakeLists.txt
@@ -1,8 +1,9 @@
set(LLVM_USED_LIBS libclang)
set( LLVM_LINK_COMPONENTS
- support
+ bitreader
mc
+ core
)
add_clang_executable(c-index-test
diff --git a/tools/c-index-test/Makefile b/tools/c-index-test/Makefile
index 3d9849a3a4..f41aa80981 100644
--- a/tools/c-index-test/Makefile
+++ b/tools/c-index-test/Makefile
@@ -13,7 +13,7 @@ TOOLNAME = c-index-test
# No plugins, optimize startup time.
TOOL_NO_EXPORTS = 1
-LINK_COMPONENTS := support mc
+LINK_COMPONENTS := bitreader mc core
USEDLIBS = clang.a clangIndex.a clangFrontend.a clangDriver.a \
clangSerialization.a clangParse.a clangSema.a clangAnalysis.a \
clangAST.a clangLex.a clangBasic.a
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index 7fb394fa5b..1f8d1129da 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -24,6 +24,7 @@
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/FrontendTool/Utils.h"
+#include "llvm/LLVMContext.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
@@ -117,6 +118,8 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd,
llvm::OwningPtr<CompilerInstance> Clang(new CompilerInstance());
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+ Clang->setLLVMContext(new llvm::LLVMContext());
+
// Run clang -cc1 test.
if (ArgBegin != ArgEnd && llvm::StringRef(ArgBegin[0]) == "-cc1test") {
Diagnostic Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(),
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index da72f5a02d..661fddd822 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -11,8 +11,9 @@ set(LLVM_USED_LIBS
clangBasic)
set( LLVM_LINK_COMPONENTS
- support
+ bitreader
mc
+ core
)
add_clang_library(libclang
diff --git a/tools/libclang/Makefile b/tools/libclang/Makefile
index e684652aa4..6d2a13cfc0 100644
--- a/tools/libclang/Makefile
+++ b/tools/libclang/Makefile
@@ -15,7 +15,7 @@ EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/libclang.exports
LINK_LIBS_IN_SHARED = 1
SHARED_LIBRARY = 1
-LINK_COMPONENTS := support mc
+LINK_COMPONENTS := bitreader mc core
USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \
clangSema.a clangAnalysis.a clangAST.a clangLex.a clangBasic.a
diff --git a/unittests/Basic/Makefile b/unittests/Basic/Makefile
index 4bac50c12a..e7ac57cbe1 100644
--- a/unittests/Basic/Makefile
+++ b/unittests/Basic/Makefile
@@ -9,7 +9,7 @@
CLANG_LEVEL = ../..
TESTNAME = Basic
-LINK_COMPONENTS := support mc
+LINK_COMPONENTS := core support mc
USEDLIBS = clangBasic.a
include $(CLANG_LEVEL)/unittests/Makefile
diff --git a/unittests/Frontend/FrontendActionTest.cpp b/unittests/Frontend/FrontendActionTest.cpp
index a32388a062..49a63983f0 100644
--- a/unittests/Frontend/FrontendActionTest.cpp
+++ b/unittests/Frontend/FrontendActionTest.cpp
@@ -14,6 +14,7 @@
#include "clang/Frontend/FrontendAction.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Support/MemoryBuffer.h"
#include "gtest/gtest.h"
@@ -60,6 +61,7 @@ TEST(ASTFrontendAction, Sanity) {
invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu";
CompilerInstance compiler;
+ compiler.setLLVMContext(new LLVMContext);
compiler.setInvocation(invocation);
compiler.createDiagnostics(0, NULL);
diff --git a/unittests/Frontend/Makefile b/unittests/Frontend/Makefile
index 4d9937f517..cdbfb4c57c 100644
--- a/unittests/Frontend/Makefile
+++ b/unittests/Frontend/Makefile
@@ -9,7 +9,7 @@
CLANG_LEVEL = ../..
TESTNAME = Frontend
-LINK_COMPONENTS := support mc
+LINK_COMPONENTS := core support mc
USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \
clangStaticAnalyzerCheckers.a clangStaticAnalyzerCore.a \