aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-28 18:32:17 +0000
committerOwen Anderson <resistor@mac.com>2009-07-28 18:32:17 +0000
commit1fd7096407d5e598ed3366a1141548e71273f1c5 (patch)
tree1d75f632724874d39fcab0f961b588afe4dbadbd /include
parent8e7c38e17b4c3eef8c079004f01329b7bd2bb24a (diff)
downloadexternal_llvm-1fd7096407d5e598ed3366a1141548e71273f1c5.zip
external_llvm-1fd7096407d5e598ed3366a1141548e71273f1c5.tar.gz
external_llvm-1fd7096407d5e598ed3366a1141548e71273f1c5.tar.bz2
Change ConstantArray to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Constants.h14
-rw-r--r--include/llvm/LLVMContext.h21
-rw-r--r--include/llvm/Support/IRBuilder.h2
3 files changed, 15 insertions, 22 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index af7187d..442472a 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -327,10 +327,22 @@ class ConstantArray : public Constant {
friend struct ConstantCreator<ConstantArray, ArrayType,
std::vector<Constant*> >;
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
- friend class LLVMContextImpl;
protected:
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
public:
+ // ConstantArray accessors
+ static Constant* get(const ArrayType* T, const std::vector<Constant*>& V);
+ static Constant* get(const ArrayType* T, Constant* const* Vals,
+ unsigned NumVals);
+
+ /// This method constructs a ConstantArray and initializes it with a text
+ /// string. The default behavior (AddNull==true) causes a null terminator to
+ /// be placed at the end of the array. This effectively increases the length
+ /// of the array by one (you've been warned). However, in some situations
+ /// this is not desired so if AddNull==false then the string is copied without
+ /// null termination.
+ static Constant* get(const StringRef &Initializer, bool AddNull = true);
+
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index 8465e4d..03de906 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -58,6 +58,7 @@ class LLVMContext {
friend class ConstantInt;
friend class ConstantFP;
friend class ConstantStruct;
+ friend class ConstantArray;
public:
LLVMContext();
~LLVMContext();
@@ -82,21 +83,6 @@ public:
// ConstantAggregateZero accessors
ConstantAggregateZero* getConstantAggregateZero(const Type* Ty);
-
- // ConstantArray accessors
- Constant* getConstantArray(const ArrayType* T,
- const std::vector<Constant*>& V);
- Constant* getConstantArray(const ArrayType* T, Constant* const* Vals,
- unsigned NumVals);
-
- /// This method constructs a ConstantArray and initializes it with a text
- /// string. The default behavior (AddNull==true) causes a null terminator to
- /// be placed at the end of the array. This effectively increases the length
- /// of the array by one (you've been warned). However, in some situations
- /// this is not desired so if AddNull==false then the string is copied without
- /// null termination.
- Constant* getConstantArray(const StringRef &Initializer,
- bool AddNull = true);
// ConstantExpr accessors
Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2);
@@ -225,12 +211,7 @@ public:
void erase(MDString *M);
void erase(MDNode *M);
void erase(ConstantAggregateZero *Z);
- void erase(ConstantArray *Z);
void erase(ConstantVector *V);
-
- // RAUW helpers
- Constant *replaceUsesOfWithOnConstant(ConstantArray *CA,
- Value *From, Value *To, Use *U);
};
/// FOR BACKWARDS COMPATIBILITY - Returns a global context.
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index d22bc3d..12439d4 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -413,7 +413,7 @@ public:
return CreateConstGEP2_32(Ptr, 0, Idx, Name);
}
Value *CreateGlobalString(const char *Str = "", const char *Name = "") {
- Constant *StrConstant = Context.getConstantArray(Str, true);
+ Constant *StrConstant = ConstantArray::get(Str, true);
Module &M = *BB->getParent()->getParent();
GlobalVariable *gv = new GlobalVariable(M,
StrConstant->getType(),