diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-04-02 18:55:21 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-04-02 18:55:21 +0000 |
commit | e3b172afc33004cb11299e21dbea1dbb4cc4dc27 (patch) | |
tree | 2da7994df7369352010a32f0c0c489f7c8c19ea7 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | a64723c2bf3a6dade77aa9b87046ec1e72b0a669 (diff) | |
download | llvm-e3b172afc33004cb11299e21dbea1dbb4cc4dc27.zip llvm-e3b172afc33004cb11299e21dbea1dbb4cc4dc27.tar.gz llvm-e3b172afc33004cb11299e21dbea1dbb4cc4dc27.tar.bz2 |
[opaque pointer type] Update for GEP API changes in LLVM
Now the GEP constant utility functions require the type to be explicitly
passed (since eventually the pointer type will be opaque and not convey
the required type information). For now callers can still pass nullptr
(though none were needed here in Clang, which is nice) if
convenienc/necessary, but eventually that will be disallowed as well.
llvm-svn: 233937
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9abc885..49cfefa 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2633,7 +2633,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { llvm::Constant *GV = CreateRuntimeVariable(Ty, "__CFConstantStringClassReference"); // Decay array -> ptr - V = llvm::ConstantExpr::getGetElementPtr(GV, Zeros); + V = llvm::ConstantExpr::getGetElementPtr(Ty, GV, Zeros); CFConstantStringClassRef = V; } else @@ -2686,7 +2686,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { } // String. - Fields[2] = llvm::ConstantExpr::getGetElementPtr(GV, Zeros); + Fields[2] = llvm::ConstantExpr::getGetElementPtr(GV->getType(), GV, Zeros); if (isUTF16) // Cast the UTF16 string to the correct type. @@ -2740,7 +2740,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { llvm::Type *PTy = llvm::ArrayType::get(Ty, 0); GV = CreateRuntimeVariable(PTy, str); // Decay array -> ptr - V = llvm::ConstantExpr::getGetElementPtr(GV, Zeros); + V = llvm::ConstantExpr::getGetElementPtr(PTy, GV, Zeros); ConstantStringClassRef = V; } } @@ -2800,8 +2800,9 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { // of the string is via this class initializer. CharUnits Align = getContext().getTypeAlignInChars(getContext().CharTy); GV->setAlignment(Align.getQuantity()); - Fields[1] = llvm::ConstantExpr::getGetElementPtr(GV, Zeros); - + Fields[1] = + llvm::ConstantExpr::getGetElementPtr(GV->getValueType(), GV, Zeros); + // String length. llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy); Fields[2] = llvm::ConstantInt::get(Ty, StringLength); |