summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.h
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-02-03 20:00:54 +0000
committerAdrian Prantl <aprantl@apple.com>2015-02-03 20:00:54 +0000
commit95b24e9b59f7d5f6b29736dd6b7db9b032ce5701 (patch)
treed98996b548857342fa41cb1406d10e748acca83a /clang/lib/CodeGen/CGDebugInfo.h
parent6c5e36ae3be87fefcec9177eae3aacd115905332 (diff)
downloadbcm5719-llvm-95b24e9b59f7d5f6b29736dd6b7db9b032ce5701.tar.gz
bcm5719-llvm-95b24e9b59f7d5f6b29736dd6b7db9b032ce5701.zip
Address review feedback for r228003.
- use named constructors - get rid of MarkAsPrologue llvm-svn: 228021
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.h')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.h50
1 files changed, 36 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 2f0c3f51d41..1d61d14950e 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -447,22 +447,23 @@ private:
/// location or preferred location of the specified Expr.
class ApplyDebugLocation {
private:
- void init(SourceLocation TemporaryLocation, bool MarkAsPrologue = false);
+ void init(SourceLocation TemporaryLocation, bool DefaultToEmpty = false);
+ ApplyDebugLocation(CodeGenFunction &CGF, bool DefaultToEmpty,
+ SourceLocation TemporaryLocation);
-protected:
llvm::DebugLoc OriginalLocation;
CodeGenFunction &CGF;
-
public:
- enum { Artificial = false, MarkAsPrologue = true, NoLocation = true };
/// \brief Set the location to the (valid) TemporaryLocation.
ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);
- /// \brief Apply TemporaryLocation if it is valid, or apply a default
- /// location: If MarkAsPrologue is true, the IRBuilder will be set to not
- /// attach debug locations, thus marking the instructions as
- /// prologue. Otherwise this switches to an artificial debug location that has
- /// a valid scope, but no line information.
+ ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);
+ ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
+
+ ~ApplyDebugLocation();
+
+ /// \brief Apply TemporaryLocation if it is valid. Otherwise switch to an
+ /// artificial debug location that has a valid scope, but no line information.
///
/// Artificial locations are useful when emitting compiler-generated helper
/// functions that have no source location associated with them. The DWARF
@@ -470,11 +471,32 @@ public:
/// indicate code that can not be attributed to any source location. Note that
/// passing an empty SourceLocation to CGDebugInfo::setLocation() will result
/// in the last valid location being reused.
- ApplyDebugLocation(CodeGenFunction &CGF, bool MarkAsPrologue,
- SourceLocation TemporaryLocation = SourceLocation());
- ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);
- ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
- ~ApplyDebugLocation();
+ static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF) {
+ return ApplyDebugLocation(CGF, false, SourceLocation());
+ }
+ /// \brief Apply TemporaryLocation if it is valid. Otherwise switch to an
+ /// artificial debug location that has a valid scope, but no line information.
+ static ApplyDebugLocation CreateDefaultArtificial(CodeGenFunction &CGF,
+ SourceLocation TemporaryLocation) {
+ return ApplyDebugLocation(CGF, false, TemporaryLocation);
+ }
+
+ /// \brief Set the IRBuilder to not attach debug locations. Note that passing
+ /// an empty SourceLocation to CGDebugInfo::setLocation() will result in the
+ /// last valid location being reused. Note that all instructions that do not
+ /// have a location at the beginning of a function are counted towards to
+ /// funciton prologue.
+ static ApplyDebugLocation CreateEmpty(CodeGenFunction &CGF) {
+ return ApplyDebugLocation(CGF, true, SourceLocation());
+ }
+
+ /// \brief Apply TemporaryLocation if it is valid. Otherwise set the IRBuilder
+ /// to not attach debug locations.
+ static ApplyDebugLocation CreateDefaultEmpty(CodeGenFunction &CGF,
+ SourceLocation TemporaryLocation) {
+ return ApplyDebugLocation(CGF, true, TemporaryLocation);
+ }
+
};
OpenPOWER on IntegriCloud