]> granicus.if.org Git - llvm/commitdiff
Remove an unnecessary const_cast.
authorAdam Nemet <anemet@apple.com>
Mon, 28 Aug 2017 23:00:13 +0000 (23:00 +0000)
committerAdam Nemet <anemet@apple.com>
Mon, 28 Aug 2017 23:00:13 +0000 (23:00 +0000)
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

lib/Analysis/OptimizationDiagnosticInfo.cpp

index eb259fd7a3840c776105f70e003ea39e248c19cc..c31de0fc42e7b5f1d45643590b66c0c1781df65f 100644 (file)
@@ -165,7 +165,8 @@ void OptimizationRemarkEmitter::emit(
 
   yaml::Output *Out = F->getContext().getDiagnosticsOutputFile();
   if (Out) {
-    auto *P = const_cast<DiagnosticInfoOptimizationBase *>(&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