[llvm] r207774 - Fixing a cast-qual warning. getBufferStart() and getBufferEnd() both return a const char *, so casting to non-const was triggering a warning (even though the assignment and usage was always const anyway).

Aaron Ballman aaron at aaronballman.com
Thu May 1 10:16:24 PDT 2014


Author: aaronballman
Date: Thu May  1 12:16:24 2014
New Revision: 207774

URL: http://llvm.org/viewvc/llvm-project?rev=207774&view=rev
Log:
Fixing a cast-qual warning. getBufferStart() and getBufferEnd() both return a const char *, so casting to non-const was triggering a warning (even though the assignment and usage was always const anyway).

No functional changes intended.

Modified:
    llvm/trunk/lib/ProfileData/InstrProfReader.cpp

Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=207774&r1=207773&r2=207774&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Thu May  1 12:16:24 2014
@@ -262,9 +262,10 @@ bool IndexedInstrProfReader::hasFormat(c
 }
 
 error_code IndexedInstrProfReader::readHeader() {
-  const unsigned char *Start = (unsigned char *)DataBuffer->getBufferStart();
+  const unsigned char *Start =
+      (const unsigned char *)DataBuffer->getBufferStart();
   const unsigned char *Cur = Start;
-  if ((unsigned char *)DataBuffer->getBufferEnd() - Cur < 24)
+  if ((const unsigned char *)DataBuffer->getBufferEnd() - Cur < 24)
     return error(instrprof_error::truncated);
 
   using namespace support;





More information about the llvm-commits mailing list