Skip to content

Commit

Permalink
fix build with llvm 3.1
Browse files Browse the repository at this point in the history
Conflicts:

	compiler/src/codegen.cpp
  • Loading branch information
crabtw authored and jckarter committed Jul 19, 2012
1 parent 47b7c00 commit 2b96439
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if(UNIX)
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT ${LLVM_VERSION} STREQUAL "3.0")
message(FATAL_ERROR "Clay requires LLVM 3.0.")
if(NOT ${LLVM_VERSION} STREQUAL "3.1")
message(FATAL_ERROR "Clay requires LLVM 3.1.")
endif()

execute_process(
Expand Down
12 changes: 6 additions & 6 deletions compiler/src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,9 @@ void codegenExpr(ExprPtr expr,
case STRING_LITERAL : {
StringLiteral *x = (StringLiteral *)expr.ptr();
llvm::Constant *initializer =
llvm::ConstantArray::get(llvm::getGlobalContext(),
x->value,
true);
llvm::ConstantDataArray::getString(llvm::getGlobalContext(),
x->value,
true);
TypePtr type = arrayType(int8Type, x->value.size() + 1);
ostringstream symbolName;
symbolName << "StringConstant " << x->value << " clay";
Expand Down Expand Up @@ -2775,7 +2775,7 @@ void codegenLLVMBody(InvokeEntryPtr entry, const string &callableName)

if(!llvm::ParseAssembly(buf, llvmModule, err,
llvm::getGlobalContext())) {
err.Print("\n", out);
err.print("\n", out);
std::cerr << out.str() << std::endl;
error("llvm assembly parse error");
}
Expand Down Expand Up @@ -6155,7 +6155,7 @@ static void codegenTopLevelLLVMRecursive(ModulePtr m)
llvm::getGlobalContext())) {
string errBuf;
llvm::raw_string_ostream errOut(errBuf);
err.Print("\n", errOut);
err.print("\n", errOut);
std::cerr << errOut.str() << std::endl;
error("llvm assembly parse error");
}
Expand Down Expand Up @@ -6463,7 +6463,7 @@ llvm::TargetMachine *initLLVM(std::string const &targetTriple,
llvm::CodeModel::Model codeModel = llvm::CodeModel::Default;

llvm::TargetMachine *targetMachine = target->createTargetMachine(
targetTriple, "", "", reloc, codeModel);
targetTriple, "", "", llvm::TargetOptions(), reloc, codeModel);

if (targetMachine != NULL) {
llvmTargetData = targetMachine->getTargetData();
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void generateAssembly(llvm::Module *module,
bool debug)
{
if (optLevel < 2 || debug)
llvm::NoFramePointerElim = true;
targetMachine->Options.NoFramePointerElim = 1;

llvm::FunctionPassManager fpasses(module);

Expand Down Expand Up @@ -381,7 +381,7 @@ int main2(int argc, char **argv, char const* const* envp) {

string clayFile;
string outputFile;
string targetTriple = llvm::sys::getHostTriple();
string targetTriple = llvm::sys::getDefaultTargetTriple();

string clayScriptImports;
string clayScript;
Expand Down Expand Up @@ -568,7 +568,7 @@ int main2(int argc, char **argv, char const* const* envp) {
cerr << "error: target name missing after -target\n";
return 1;
}
crossCompiling = targetTriple != llvm::sys::getHostTriple();
crossCompiling = targetTriple != llvm::sys::getDefaultTargetTriple();
}
else if (strstr(argv[i], "-Wl") == argv[i]) {
linkerFlags += argv[i] + strlen("-Wl");
Expand Down

0 comments on commit 2b96439

Please sign in to comment.