Update for LLVM api change.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Jun 2015 13:59:36 +0000 (13:59 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Jun 2015 13:59:36 +0000 (13:59 +0000)
llvm-svn: 240406

clang/lib/CodeGen/BackendUtil.cpp
clang/tools/libclang/CIndex.cpp

index f5edea7..801b49f 100644 (file)
@@ -604,7 +604,10 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
   if (!TM)
     TM.reset(CreateTargetMachine(UsesCodeGen));
 
-  if (UsesCodeGen && !TM) return;
+  if (UsesCodeGen && !TM)
+    return;
+  if (TM)
+    TheModule->setDataLayout(*TM->getDataLayout());
   CreatePasses();
 
   switch (Action) {
index 2216ec6..adf8d97 100644 (file)
@@ -3827,12 +3827,11 @@ CXString clang_Cursor_getMangling(CXCursor C) {
   // Now apply backend mangling.
   std::unique_ptr<llvm::DataLayout> DL(
       new llvm::DataLayout(Ctx.getTargetInfo().getTargetDescription()));
-  llvm::Mangler BackendMangler(DL.get());
 
   std::string FinalBuf;
   llvm::raw_string_ostream FinalBufOS(FinalBuf);
-  BackendMangler.getNameWithPrefix(FinalBufOS,
-                                   llvm::Twine(FrontendBufOS.str()));
+  llvm::Mangler::getNameWithPrefix(FinalBufOS, llvm::Twine(FrontendBufOS.str()),
+                                   *DL);
 
   return cxstring::createDup(FinalBufOS.str());
 }