summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DiagnosticInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/DiagnosticInfo.cpp')
-rw-r--r--llvm/lib/IR/DiagnosticInfo.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index ea71fde26e0..6a3fdcff233 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -170,25 +170,14 @@ const std::string DiagnosticInfoWithDebugLocBase::getLocationStr() const {
getLocation(&Filename, &Line, &Column);
return (Filename + ":" + Twine(Line) + ":" + Twine(Column)).str();
}
-
DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Value *V)
- : Key(Key) {
+ : Key(Key), Val(GlobalValue::getRealLinkageName(V->getName())) {
if (auto *F = dyn_cast<Function>(V)) {
if (DISubprogram *SP = F->getSubprogram())
DLoc = DebugLoc::get(SP->getScopeLine(), 0, SP);
}
else if (auto *I = dyn_cast<Instruction>(V))
DLoc = I->getDebugLoc();
-
- // Only include names that correspond to user variables. FIXME: we should use
- // debug info if available to get the name of the user variable.
- if (isa<llvm::Argument>(V) || isa<GlobalValue>(V))
- Val = GlobalValue::getRealLinkageName(V->getName());
- else if (isa<Constant>(V)) {
- raw_string_ostream OS(Val);
- V->printAsOperand(OS, /*PrintType=*/false);
- } else if (auto *I = dyn_cast<Instruction>(V))
- Val = I->getOpcodeName();
}
DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Type *T)
@@ -370,19 +359,10 @@ operator<<(setIsVerbose V) {
return *this;
}
-DiagnosticInfoOptimizationBase &DiagnosticInfoOptimizationBase::
-operator<<(setExtraArgs EA) {
- FirstExtraArgIndex = Args.size();
- return *this;
-}
-
std::string DiagnosticInfoOptimizationBase::getMsg() const {
std::string Str;
raw_string_ostream OS(Str);
- for (const DiagnosticInfoOptimizationBase::Argument &Arg :
- make_range(Args.begin(), FirstExtraArgIndex == -1
- ? Args.end()
- : Args.begin() + FirstExtraArgIndex))
+ for (const DiagnosticInfoOptimizationBase::Argument &Arg : Args)
OS << Arg.Val;
return OS.str();
}
OpenPOWER on IntegriCloud