From: Adam Nemet Date: Mon, 28 Aug 2017 23:00:13 +0000 (+0000) Subject: Remove an unnecessary const_cast. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0827f9ac83209d6e44e2c4e537ec508029b53599;p=llvm Remove an unnecessary const_cast. I think that this is dating back to when emit used to take a const reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311948 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/OptimizationDiagnosticInfo.cpp b/lib/Analysis/OptimizationDiagnosticInfo.cpp index eb259fd7a38..c31de0fc42e 100644 --- a/lib/Analysis/OptimizationDiagnosticInfo.cpp +++ b/lib/Analysis/OptimizationDiagnosticInfo.cpp @@ -165,7 +165,8 @@ void OptimizationRemarkEmitter::emit( yaml::Output *Out = F->getContext().getDiagnosticsOutputFile(); if (Out) { - auto *P = const_cast(&OptDiagBase); + // For remarks the << operator takes a reference to a pointer. + auto *P = &OptDiagBase; *Out << P; } // FIXME: now that IsVerbose is part of DI, filtering for this will be moved