[llvm] r219817 - correct const-ness with auto and dyn_cast
Sanjay Patel
spatel at rotateright.com
Wed Oct 15 10:45:13 PDT 2014
Author: spatel
Date: Wed Oct 15 12:45:13 2014
New Revision: 219817
URL: http://llvm.org/viewvc/llvm-project?rev=219817&view=rev
Log:
correct const-ness with auto and dyn_cast
1. Use const with autos.
2. Don't bother with explicit const in cast ops because they do it automagically.
Thanks, David B. / Aaron B. / Reid K.
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=219817&r1=219816&r2=219817&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Oct 15 12:45:13 2014
@@ -710,15 +710,15 @@ static void WriteModuleInfo(const Module
static uint64_t GetOptimizationFlags(const Value *V) {
uint64_t Flags = 0;
- if (auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
+ if (const auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
if (OBO->hasNoSignedWrap())
Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP;
if (OBO->hasNoUnsignedWrap())
Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP;
- } else if (auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
+ } else if (const auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
if (PEO->isExact())
Flags |= 1 << bitc::PEO_EXACT;
- } else if (auto *FPMO = dyn_cast<const FPMathOperator>(V)) {
+ } else if (const auto *FPMO = dyn_cast<FPMathOperator>(V)) {
if (FPMO->hasUnsafeAlgebra())
Flags |= FastMathFlags::UnsafeAlgebra;
if (FPMO->hasNoNaNs())
More information about the llvm-commits
mailing list