From: Ahmed Bougacha Date: Wed, 15 Feb 2017 20:38:28 +0000 (+0000) Subject: [OptDiag] Pass const Values/Types to Argument. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffb0b39cd02693661f500df231dfa707a6598137;p=llvm [OptDiag] Pass const Values/Types to Argument. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295228 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h index 1a5770c8632..5575db36bb1 100644 --- a/include/llvm/IR/DiagnosticInfo.h +++ b/include/llvm/IR/DiagnosticInfo.h @@ -403,8 +403,8 @@ public: DebugLoc DLoc; explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {} - Argument(StringRef Key, Value *V); - Argument(StringRef Key, Type *T); + Argument(StringRef Key, const Value *V); + Argument(StringRef Key, const Type *T); Argument(StringRef Key, int N); Argument(StringRef Key, unsigned N); Argument(StringRef Key, bool B) : Key(Key), Val(B ? "true" : "false") {} diff --git a/lib/IR/DiagnosticInfo.cpp b/lib/IR/DiagnosticInfo.cpp index d27eb7672d8..ad172486d37 100644 --- a/lib/IR/DiagnosticInfo.cpp +++ b/lib/IR/DiagnosticInfo.cpp @@ -171,7 +171,7 @@ const std::string DiagnosticInfoWithDebugLocBase::getLocationStr() const { return (Filename + ":" + Twine(Line) + ":" + Twine(Column)).str(); } -DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Value *V) +DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, const Value *V) : Key(Key) { if (auto *F = dyn_cast(V)) { if (DISubprogram *SP = F->getSubprogram()) @@ -191,7 +191,7 @@ DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Value *V) Val = I->getOpcodeName(); } -DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, Type *T) +DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, const Type *T) : Key(Key) { raw_string_ostream OS(Val); OS << *T;