[llvm] r263349 - Use templated version of unwrap instead of cats in the Core.cpp. NFC

Amaury Sechet via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 12 16:54:40 PST 2016


Author: deadalnix
Date: Sat Mar 12 18:54:40 2016
New Revision: 263349

URL: http://llvm.org/viewvc/llvm-project?rev=263349&view=rev
Log:
Use templated version of unwrap instead of cats in the Core.cpp. NFC

Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/include/llvm/IR/Constants.h
    llvm/trunk/lib/IR/Core.cpp

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=263349&r1=263348&r2=263349&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Sat Mar 12 18:54:40 2016
@@ -1569,7 +1569,7 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTy
  *
  * @see ConstantDataSequential::getElementAsConstant()
  */
-LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx);
+LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx);
 
 /**
  * Create a ConstantVector from values.

Modified: llvm/trunk/include/llvm/IR/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Constants.h?rev=263349&r1=263348&r2=263349&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Constants.h (original)
+++ llvm/trunk/include/llvm/IR/Constants.h Sat Mar 12 18:54:40 2016
@@ -613,7 +613,6 @@ public:
   /// The size of the elements is known to be a multiple of one byte.
   uint64_t getElementByteSize() const;
 
-
   /// This method returns true if this is an array of i8.
   bool isString() const;
 

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=263349&r1=263348&r2=263349&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Sat Mar 12 18:54:40 2016
@@ -910,22 +910,23 @@ LLVMValueRef LLVMConstStringInContext(LL
   return wrap(ConstantDataArray::getString(*unwrap(C), StringRef(Str, Length),
                                            DontNullTerminate == 0));
 }
+
 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
                              LLVMBool DontNullTerminate) {
   return LLVMConstStringInContext(LLVMGetGlobalContext(), Str, Length,
                                   DontNullTerminate);
 }
 
-LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx) {
-  return wrap(static_cast<ConstantDataSequential*>(unwrap(c))->getElementAsConstant(idx));
+LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx) {
+  return wrap(unwrap<ConstantDataSequential>(C)->getElementAsConstant(idx));
 }
 
-LLVMBool LLVMIsConstantString(LLVMValueRef c) {
-  return static_cast<ConstantDataSequential*>(unwrap(c))->isString();
+LLVMBool LLVMIsConstantString(LLVMValueRef C) {
+  return unwrap<ConstantDataSequential>(C)->isString();
 }
 
-const char *LLVMGetAsString(LLVMValueRef c, size_t* Length) {
-  StringRef str = static_cast<ConstantDataSequential*>(unwrap(c))->getAsString();
+const char *LLVMGetAsString(LLVMValueRef C, size_t* Length) {
+  StringRef str = unwrap<ConstantDataSequential>(C)->getAsString();
   *Length = str.size();
   return str.data();
 }




More information about the llvm-commits mailing list