<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 1, 2015 at 3:20 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ctopper<br>
Date: Sat Aug  1 17:20:27 2015<br>
New Revision: 243843<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243843-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=up_2b92xmKhvZUc-atJnZj6lMQJIQfmQYmYL-M27N0o&s=QQ3D6rPo1q4LU2lWzwSioYgSvxIhqRXsNNO_E-qsMU0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243843&view=rev</a><br>
Log:<br>
Merge the const and non-const Type::getScalarType to a const version that returns a non-const pointer. Since we don't put const on Types all places were already calling the non-const version.<br></blockquote><div><br></div><div>Any particular reason to keep the const version, if everyone should be calling it from a non-const pointer? (by making it non-const it'll catch some cases where people add unnecessary const) But I'm not too fussed.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/Type.h<br>
    llvm/trunk/lib/IR/Type.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/IR/Type.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_IR_Type.h-3Frev-3D243843-26r1-3D243842-26r2-3D243843-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=up_2b92xmKhvZUc-atJnZj6lMQJIQfmQYmYL-M27N0o&s=iWnEocba1JWlvG_8oOXZxn3xVf4eGY-hyjFnblIRynU&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Type.h?rev=243843&r1=243842&r2=243843&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/Type.h (original)<br>
+++ llvm/trunk/include/llvm/IR/Type.h Sat Aug  1 17:20:27 2015<br>
@@ -304,8 +304,7 @@ public:<br>
<br>
   /// getScalarType - If this is a vector type, return the element type,<br>
   /// otherwise return 'this'.<br>
-  const Type *getScalarType() const LLVM_READONLY;<br>
-  Type *getScalarType() LLVM_READONLY;<br>
+  Type *getScalarType() const LLVM_READONLY;<br>
<br>
   //===--------------------------------------------------------------------===//<br>
   // Type Iteration support.<br>
<br>
Modified: llvm/trunk/lib/IR/Type.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_IR_Type.cpp-3Frev-3D243843-26r1-3D243842-26r2-3D243843-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=up_2b92xmKhvZUc-atJnZj6lMQJIQfmQYmYL-M27N0o&s=4jospkGk-Mi49diG5U6fGHGPKMOuTyYxpgrLi1CJS9Q&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Type.cpp?rev=243843&r1=243842&r2=243843&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/Type.cpp (original)<br>
+++ llvm/trunk/lib/IR/Type.cpp Sat Aug  1 17:20:27 2015<br>
@@ -42,16 +42,10 @@ Type *Type::getPrimitiveType(LLVMContext<br>
<br>
 /// getScalarType - If this is a vector type, return the element type,<br>
 /// otherwise return this.<br>
-Type *Type::getScalarType() {<br>
-  if (VectorType *VTy = dyn_cast<VectorType>(this))<br>
+Type *Type::getScalarType() const {<br>
+  if (auto *VTy = dyn_cast<VectorType>(this))<br>
     return VTy->getElementType();<br>
-  return this;<br>
-}<br>
-<br>
-const Type *Type::getScalarType() const {<br>
-  if (const VectorType *VTy = dyn_cast<VectorType>(this))<br>
-    return VTy->getElementType();<br>
-  return this;<br>
+  return const_cast<Type*>(this);<br>
 }<br>
<br>
 /// isIntegerTy - Return true if this is an IntegerType of the specified width.<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>