Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.

llvm-svn: 82570
This commit is contained in:
Devang Patel 2009-09-22 20:56:31 +00:00
parent 276b02b325
commit 320a1c4083
1 changed files with 9 additions and 3 deletions

View File

@ -131,8 +131,8 @@ public:
InsertPt = IP;
}
/// SetCurrentLocation - This specifies the location information used
/// by debugging information.
/// SetCurrentLocation - Set location information used by debugging
/// information.
void SetCurrentLocation(MDNode *L) {
if (MDKind == 0)
MDKind = Context.getMetadata().getMDKind("dbg");
@ -142,7 +142,13 @@ public:
}
MDNode *getCurrentLocation() const { return CurLocation; }
/// SetLocation - Set location information for the given instruction.
void SetLocation(Instruction *I) {
if (CurLocation)
Context.getMetadata().setMD(MDKind, CurLocation, I);
}
/// Insert - Insert and return the specified instruction.
template<typename InstTy>
InstTy *Insert(InstTy *I, const Twine &Name = "") const {