aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2013-05-02 17:27:49 +0000
committerAdrian Prantl <aprantl@apple.com>2013-05-02 17:27:49 +0000
commitf9bccc2f1a78ad1ffecc1e95c47a30e6adb3ef5c (patch)
treeacba771f228fdd2748c09ca745ed5a1e0c35a0ae /include
parentf945d09d53a4f2f392b8b51191d37de2f8acd566 (diff)
Provide an API to temporarily suppress DebugLocations from being attached
to emitted instructions. Use this if you want an instruction to be counted towards the prologue or if there is no useful source location. rdar://problem/13442648 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/IRBuilder.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h
index 189ba3d305..f11d3b4e0b 100644
--- a/include/llvm/IR/IRBuilder.h
+++ b/include/llvm/IR/IRBuilder.h
@@ -49,6 +49,10 @@ protected:
class IRBuilderBase {
DebugLoc CurDbgLocation;
protected:
+ /// Save the current debug location here while we are suppressing
+ /// line table entries.
+ llvm::DebugLoc SavedDbgLocation;
+
BasicBlock *BB;
BasicBlock::iterator InsertPt;
LLVMContext &Context;
@@ -113,6 +117,23 @@ public:
CurDbgLocation = L;
}
+ /// \brief Temporarily suppress DebugLocations from being attached
+ /// to emitted instructions, until the next call to
+ /// SetCurrentDebugLocation() or EnableDebugLocations(). Use this
+ /// if you want an instruction to be counted towards the prologue or
+ /// if there is no useful source location.
+ void DisableDebugLocations() {
+ llvm::DebugLoc Empty;
+ SavedDbgLocation = getCurrentDebugLocation();
+ SetCurrentDebugLocation(Empty);
+ }
+
+ /// \brief Restore the previously saved DebugLocation.
+ void EnableDebugLocations() {
+ assert(CurDbgLocation.isUnknown());
+ SetCurrentDebugLocation(SavedDbgLocation);
+ }
+
/// \brief Get location information used by debugging information.
DebugLoc getCurrentDebugLocation() const { return CurDbgLocation; }