Revision: 3687 http://trac.macosforge.org/projects/ruby/changeset/3687 Author: lsansonetti@apple.com Date: 2010-03-03 14:54:51 -0800 (Wed, 03 Mar 2010) Log Message: ----------- work with newer LLVM Modified Paths: -------------- MacRuby/trunk/compiler.cpp MacRuby/trunk/rakelib/builder/options.rb MacRuby/trunk/vm.cpp Modified: MacRuby/trunk/compiler.cpp =================================================================== --- MacRuby/trunk/compiler.cpp 2010-03-03 22:37:48 UTC (rev 3686) +++ MacRuby/trunk/compiler.cpp 2010-03-03 22:54:51 UTC (rev 3687) @@ -188,10 +188,14 @@ level = 0; #endif +#if LLVM_TOT + dbg_mdkind = context.getMDKindID("dbg"); +#else dbg_mdkind = context.getMetadata().getMDKind("dbg"); if (dbg_mdkind == 0) { dbg_mdkind = context.getMetadata().registerMDKind("dbg"); } +#endif assert(dbg_mdkind != 0); } @@ -735,7 +739,11 @@ if (fname != NULL) { DILocation loc = debug_info->CreateLocation(current_line, 0, debug_compile_unit, DILocation(NULL)); +#if LLVM_TOT + insn->setMetadata(dbg_mdkind, loc.getNode()); +#else context.getMetadata().addMD(dbg_mdkind, loc.getNode(), insn); +#endif } } Modified: MacRuby/trunk/rakelib/builder/options.rb =================================================================== --- MacRuby/trunk/rakelib/builder/options.rb 2010-03-03 22:37:48 UTC (rev 3686) +++ MacRuby/trunk/rakelib/builder/options.rb 2010-03-03 22:54:51 UTC (rev 3687) @@ -105,7 +105,7 @@ CFLAGS = "-I. -I./include -I./onig -I/usr/include/libxml2 #{ARCHFLAGS} -fno-common -pipe -O3 -g -Wall -fexceptions" CFLAGS << " -Wno-parentheses -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD OBJC_CFLAGS = CFLAGS + " -fobjc-gc-only" -CXXFLAGS = `#{LLVM_CONFIG} --cxxflags #{LLVM_MODULES}`.sub(/-DNDEBUG/, '').strip +CXXFLAGS = `#{LLVM_CONFIG} --cxxflags #{LLVM_MODULES}`.sub(/-DNDEBUG/, '').sub(/-fno-exceptions/, '').strip CXXFLAGS << " -I. -I./include -g -Wall #{ARCHFLAGS}" CXXFLAGS << " -Wno-parentheses -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD CXXFLAGS << " -DLLVM_TOT" if ENV['LLVM_TOT'] Modified: MacRuby/trunk/vm.cpp =================================================================== --- MacRuby/trunk/vm.cpp 2010-03-03 22:37:48 UTC (rev 3686) +++ MacRuby/trunk/vm.cpp 2010-03-03 22:54:51 UTC (rev 3687) @@ -184,7 +184,6 @@ } #endif - uint8_t *startFunctionBody(const Function *F, uintptr_t &ActualSize) { return mm->startFunctionBody(F, ActualSize); @@ -237,6 +236,16 @@ std::string path; for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) { +#if LLVM_TOT + DILocation dil = Details.MF->getDILocation(iter->Loc); + if (path.size() == 0) { + DIScope scope = dil.getScope(); + path.append(scope.getDirectory()); + path.append("/"); + path.append(scope.getFilename()); + } + RoxorFunction::Line line(iter->Address, dil.getLineNumber()); +#else DebugLocTuple dlt = Details.MF->getDebugLocTuple(iter->Loc); if (path.size() == 0) { DICompileUnit unit(dlt.Scope); @@ -244,8 +253,8 @@ path.append("/"); path.append(unit.getFilename()); } - RoxorFunction::Line line(iter->Address, dlt.Line); +#endif function->lines.push_back(line); }