summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2017-02-18 00:42:23 +0000
committerJustin Bogner <mail@justinbogner.com>2017-02-18 00:42:23 +0000
commitd890f95bf6d5c8de4b0d81ed571926206e9fa034 (patch)
tree0db5b35141683bdb0f21f3d0d77a726bd94ddac6 /llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
parent431305927f21c3db7bf687175fad4883ed672492 (diff)
downloadbcm5719-llvm-d890f95bf6d5c8de4b0d81ed571926206e9fa034.tar.gz
bcm5719-llvm-d890f95bf6d5c8de4b0d81ed571926206e9fa034.zip
OptDiag: Decouple backend diagnostics from debug info metadata
This creates and uses a DiagnosticLocation type rather than using DebugLoc for this purpose in the backend diagnostics. This is NFC for now, but will allow us to create locations for diagnostics without having to create new metadata nodes when we don't have a DILocation. llvm-svn: 295519
Diffstat (limited to 'llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp')
-rw-r--r--llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
index d3f7493a787..7198e474d4b 100644
--- a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
+++ b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
@@ -99,28 +99,27 @@ void MappingTraits<DiagnosticInfoOptimizationBase *>::mapping(
llvm_unreachable("Unknown remark type");
// These are read-only for now.
- DebugLoc DL = OptDiag->getDebugLoc();
+ DiagnosticLocation DL = OptDiag->getLocation();
StringRef FN =
GlobalValue::getRealLinkageName(OptDiag->getFunction().getName());
StringRef PassName(OptDiag->PassName);
io.mapRequired("Pass", PassName);
io.mapRequired("Name", OptDiag->RemarkName);
- if (!io.outputting() || DL)
+ if (!io.outputting() || DL.isValid())
io.mapOptional("DebugLoc", DL);
io.mapRequired("Function", FN);
io.mapOptional("Hotness", OptDiag->Hotness);
io.mapOptional("Args", OptDiag->Args);
}
-template <> struct MappingTraits<DebugLoc> {
- static void mapping(IO &io, DebugLoc &DL) {
+template <> struct MappingTraits<DiagnosticLocation> {
+ static void mapping(IO &io, DiagnosticLocation &DL) {
assert(io.outputting() && "input not yet implemented");
- auto *Scope = cast<DIScope>(DL.getScope());
- StringRef File = Scope->getFilename();
+ StringRef File = DL.getFilename();
unsigned Line = DL.getLine();
- unsigned Col = DL.getCol();
+ unsigned Col = DL.getColumn();
io.mapRequired("File", File);
io.mapRequired("Line", Line);
@@ -135,8 +134,8 @@ template <> struct MappingTraits<DiagnosticInfoOptimizationBase::Argument> {
static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A) {
assert(io.outputting() && "input not yet implemented");
io.mapRequired(A.Key.data(), A.Val);
- if (A.DLoc)
- io.mapOptional("DebugLoc", A.DLoc);
+ if (A.Loc.isValid())
+ io.mapOptional("DebugLoc", A.Loc);
}
};
OpenPOWER on IntegriCloud