aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
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(),