diff options
Diffstat (limited to 'contrib/llvm/lib/IR/DiagnosticInfo.cpp')
-rw-r--r-- | contrib/llvm/lib/IR/DiagnosticInfo.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/llvm/lib/IR/DiagnosticInfo.cpp b/contrib/llvm/lib/IR/DiagnosticInfo.cpp index cfb699a..45be100 100644 --- a/contrib/llvm/lib/IR/DiagnosticInfo.cpp +++ b/contrib/llvm/lib/IR/DiagnosticInfo.cpp @@ -129,16 +129,17 @@ void DiagnosticInfoSampleProfile::print(DiagnosticPrinter &DP) const { } bool DiagnosticInfoOptimizationBase::isLocationAvailable() const { - return getDebugLoc().isUnknown() == false; + return getDebugLoc(); } void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const { - DILocation DIL(getDebugLoc().getAsMDNode(getFunction().getContext())); - *Filename = DIL.getFilename(); - *Line = DIL.getLineNumber(); - *Column = DIL.getColumnNumber(); + DILocation *L = getDebugLoc(); + assert(L != nullptr && "debug location is invalid"); + *Filename = L->getFilename(); + *Line = L->getLine(); + *Column = L->getColumn(); } const std::string DiagnosticInfoOptimizationBase::getLocationStr() const { @@ -147,7 +148,7 @@ const std::string DiagnosticInfoOptimizationBase::getLocationStr() const { unsigned Column = 0; if (isLocationAvailable()) getLocation(&Filename, &Line, &Column); - return Twine(Filename + ":" + Twine(Line) + ":" + Twine(Column)).str(); + return (Filename + ":" + Twine(Line) + ":" + Twine(Column)).str(); } void DiagnosticInfoOptimizationBase::print(DiagnosticPrinter &DP) const { |