diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-12-28 21:44:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-12-28 21:44:41 +0000 |
| commit | 5e124bf91321503b7bb1751f9a15737d2fd8e2d1 (patch) | |
| tree | 554ff4510d16074306486f46055fed54aadbdc23 /clang/lib | |
| parent | 17079fc0fa5bfe2714f1ed94789a02386289f489 (diff) | |
| download | bcm5719-llvm-5e124bf91321503b7bb1751f9a15737d2fd8e2d1.tar.gz bcm5719-llvm-5e124bf91321503b7bb1751f9a15737d2fd8e2d1.zip | |
this form of SetDebugLocation is about to go away, add some #includes that
are about to not come in implicitly.
llvm-svn: 92228
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 17 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 |
2 files changed, 15 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index b7401a40f29..0f590a31747 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -26,6 +26,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/SmallVector.h" @@ -1216,9 +1217,12 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag, llvm::DIScope DS(RegionStack.back()); llvm::DILocation DO(NULL); - llvm::DILocation DL = - DebugFactory.CreateLocation(Line, Column, DS, DO); - Builder.SetDebugLocation(Call, DL.getNode()); + llvm::DILocation DL = DebugFactory.CreateLocation(Line, Column, DS, DO); + + // TODO: Remove #include of LLVMContext from this. + llvm::LLVMContext &Context = Call->getContext(); + unsigned DbgMDKind = Context.getMetadata().getMDKindID("dbg"); + Context.getMetadata().addMD(DbgMDKind, DL.getNode(), Call); } /// EmitDeclare - Emit local variable declaration debug info. @@ -1419,7 +1423,12 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag, llvm::DILocation DO(NULL); llvm::DILocation DL = DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO); - Builder.SetDebugLocation(Call, DL.getNode()); + + // TODO: Remove #include of LLVMContext from this. + llvm::LLVMContext &Context = Call->getContext(); + unsigned DbgMDKind = Context.getMetadata().getMDKindID("dbg"); + Context.getMetadata().addMD(DbgMDKind, DL.getNode(), Call); + } void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a7e05520508..abb78f0dcfa 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -30,6 +30,7 @@ #include "llvm/CallingConv.h" #include "llvm/Module.h" #include "llvm/Intrinsics.h" +#include "llvm/LLVMContext.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/ErrorHandling.h" using namespace clang; @@ -1089,9 +1090,7 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, CI->replaceAllUsesWith(NewCall); // Copy any custom metadata attached with CI. - llvm::MetadataContext &TheMetadata = CI->getContext().getMetadata(); - TheMetadata.copyMD(CI, NewCall); - + CI->getContext().getMetadata().copyMD(CI, NewCall); CI->eraseFromParent(); } } |

