[cfe-commits] r74615 - in /cfe/trunk: include/clang/CodeGen/ModuleBuilder.h include/clang/Frontend/ASTConsumers.h lib/CodeGen/ModuleBuilder.cpp lib/Frontend/Backend.cpp tools/clang-cc/clang-cc.cpp
Owen Anderson
resistor at mac.com
Wed Jul 1 10:00:08 PDT 2009
Author: resistor
Date: Wed Jul 1 12:00:06 2009
New Revision: 74615
URL: http://llvm.org/viewvc/llvm-project?rev=74615&view=rev
Log:
Update for LLVMContext+Module change.
Modified:
cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
cfe/trunk/include/clang/Frontend/ASTConsumers.h
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/lib/Frontend/Backend.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/ModuleBuilder.h?rev=74615&r1=74614&r2=74615&view=diff
==============================================================================
--- cfe/trunk/include/clang/CodeGen/ModuleBuilder.h (original)
+++ cfe/trunk/include/clang/CodeGen/ModuleBuilder.h Wed Jul 1 12:00:06 2009
@@ -18,6 +18,7 @@
#include <string>
namespace llvm {
+ class LLVMContext;
class Module;
}
@@ -34,7 +35,8 @@
CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags,
const std::string &ModuleName,
- const CompileOptions &CO);
+ const CompileOptions &CO,
+ llvm::LLVMContext* C);
}
#endif
Modified: cfe/trunk/include/clang/Frontend/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTConsumers.h?rev=74615&r1=74614&r2=74615&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTConsumers.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTConsumers.h Wed Jul 1 12:00:06 2009
@@ -20,6 +20,7 @@
namespace llvm {
class Module;
+ class LLVMContext;
namespace sys { class Path; }
}
namespace clang {
@@ -79,7 +80,8 @@
const LangOptions &Features,
const CompileOptions &CompileOpts,
const std::string &ModuleID,
- llvm::raw_ostream *OS);
+ llvm::raw_ostream *OS,
+ llvm::LLVMContext* C);
// HTML printer: uses the rewriter to convert source code to HTML with
// syntax highlighting suitable for viewing in a web-browser.
Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=74615&r1=74614&r2=74615&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Wed Jul 1 12:00:06 2009
@@ -19,6 +19,7 @@
#include "clang/AST/Expr.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/TargetInfo.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/Compiler.h"
@@ -37,8 +38,8 @@
llvm::OwningPtr<CodeGen::CodeGenModule> Builder;
public:
CodeGeneratorImpl(Diagnostic &diags, const std::string& ModuleName,
- const CompileOptions &CO)
- : Diags(diags), CompileOpts(CO), M(new llvm::Module(ModuleName)) {}
+ const CompileOptions &CO, llvm::LLVMContext* C)
+ : Diags(diags), CompileOpts(CO), M(new llvm::Module(ModuleName, C)) {}
virtual ~CodeGeneratorImpl() {}
@@ -95,6 +96,7 @@
CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags,
const std::string& ModuleName,
- const CompileOptions &CO) {
- return new CodeGeneratorImpl(Diags, ModuleName, CO);
+ const CompileOptions &CO,
+ llvm::LLVMContext* C) {
+ return new CodeGeneratorImpl(Diags, ModuleName, CO, C);
}
Modified: cfe/trunk/lib/Frontend/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Backend.cpp?rev=74615&r1=74614&r2=74615&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Backend.cpp (original)
+++ cfe/trunk/lib/Frontend/Backend.cpp Wed Jul 1 12:00:06 2009
@@ -75,13 +75,14 @@
public:
BackendConsumer(BackendAction action, Diagnostic &Diags,
const LangOptions &langopts, const CompileOptions &compopts,
- const std::string &infile, llvm::raw_ostream* OS) :
+ const std::string &infile, llvm::raw_ostream* OS,
+ LLVMContext* C) :
Action(action),
CompileOpts(compopts),
AsmOutStream(OS),
LLVMIRGeneration("LLVM IR Generation Time"),
CodeGenerationTime("Code Generation Time"),
- Gen(CreateLLVMCodeGen(Diags, infile, compopts)),
+ Gen(CreateLLVMCodeGen(Diags, infile, compopts, C)),
TheModule(0), TheTargetData(0), ModuleProvider(0),
CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) {
@@ -359,6 +360,8 @@
const LangOptions &LangOpts,
const CompileOptions &CompileOpts,
const std::string& InFile,
- llvm::raw_ostream* OS) {
- return new BackendConsumer(Action, Diags, LangOpts, CompileOpts, InFile, OS);
+ llvm::raw_ostream* OS,
+ LLVMContext* C) {
+ return new BackendConsumer(Action, Diags, LangOpts, CompileOpts,
+ InFile, OS, C);
}
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=74615&r1=74614&r2=74615&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Jul 1 12:00:06 2009
@@ -50,6 +50,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
+#include "llvm/LLVMContext.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
@@ -1746,7 +1747,8 @@
///
static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
const std::string &InFile, ProgActions PA,
- const llvm::StringMap<bool> &Features) {
+ const llvm::StringMap<bool> &Features,
+ llvm::LLVMContext* Context) {
llvm::OwningPtr<llvm::raw_ostream> OS;
llvm::OwningPtr<ASTConsumer> Consumer;
bool ClearSourceMgr = false;
@@ -1813,7 +1815,7 @@
InitializeCompileOptions(Opts, PP.getLangOptions(), Features);
Consumer.reset(CreateBackendConsumer(Act, PP.getDiagnostics(),
PP.getLangOptions(), Opts, InFile,
- OS.get()));
+ OS.get(), Context));
break;
}
@@ -2105,9 +2107,10 @@
int main(int argc, char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
+ llvm::LLVMContext Context;
llvm::cl::ParseCommandLineOptions(argc, argv,
"LLVM 'Clang' Compiler: http://clang.llvm.org\n");
-
+
llvm::InitializeAllTargets();
llvm::InitializeAllAsmPrinters();
@@ -2281,7 +2284,7 @@
((PathDiagnosticClient*)DiagClient.get())->SetPreprocessor(PP.get());
// Process the source file.
- ProcessInputFile(*PP, PPFactory, InFile, ProgAction, Features);
+ ProcessInputFile(*PP, PPFactory, InFile, ProgAction, Features, &Context);
HeaderInfo.ClearFileInfo();
DiagClient->setLangOptions(0);
More information about the cfe-commits
mailing list