[llvm-commits] [llvm] r130086 - in /llvm/trunk: include/llvm/Analysis/DIBuilder.h lib/Analysis/DIBuilder.cpp
Jay Foad
jay.foad at gmail.com
Sun Apr 24 03:11:04 PDT 2011
Author: foad
Date: Sun Apr 24 05:11:03 2011
New Revision: 130086
URL: http://llvm.org/viewvc/llvm-project?rev=130086&view=rev
Log:
PR9214: Convert the DIBuilder API to use ArrayRef.
Modified:
llvm/trunk/include/llvm/Analysis/DIBuilder.h
llvm/trunk/lib/Analysis/DIBuilder.cpp
Modified: llvm/trunk/include/llvm/Analysis/DIBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DIBuilder.h?rev=130086&r1=130085&r2=130086&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DIBuilder.h (original)
+++ llvm/trunk/include/llvm/Analysis/DIBuilder.h Sun Apr 24 05:11:03 2011
@@ -16,6 +16,7 @@
#define LLVM_ANALYSIS_DIBUILDER_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
@@ -302,7 +303,7 @@
DIDescriptor createUnspecifiedParameter();
/// getOrCreateArray - Get a DIArray, create one if required.
- DIArray getOrCreateArray(Value *const *Elements, unsigned NumElements);
+ DIArray getOrCreateArray(ArrayRef<Value *> Elements);
/// getOrCreateSubrange - Create a descriptor for a value range. This
/// implicitly uniques the values returned.
@@ -369,14 +370,13 @@
/// @param File File where this variable is defined.
/// @param LineNo Line number.
/// @param Ty Variable Type
- /// @param Addr A pointer to a vector of complex address operations.
- /// @param NumAddr Num of address operations in the vector.
+ /// @param Addr An array of complex address operations.
/// @param ArgNo If this variable is an arugment then this argument's
/// number. 1 indicates 1st argument.
DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
StringRef Name, DIFile F, unsigned LineNo,
- DIType Ty, Value *const *Addr,
- unsigned NumAddr, unsigned ArgNo = 0);
+ DIType Ty, ArrayRef<Value *> Addr,
+ unsigned ArgNo = 0);
/// createFunction - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
Modified: llvm/trunk/lib/Analysis/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DIBuilder.cpp?rev=130086&r1=130085&r2=130086&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DIBuilder.cpp (original)
+++ llvm/trunk/lib/Analysis/DIBuilder.cpp Sun Apr 24 05:11:03 2011
@@ -537,14 +537,12 @@
}
/// getOrCreateArray - Get a DIArray, create one if required.
-DIArray DIBuilder::getOrCreateArray(Value *const *Elements,
- unsigned NumElements) {
- if (NumElements == 0) {
+DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
+ if (Elements.empty()) {
Value *Null = llvm::Constant::getNullValue(Type::getInt32Ty(VMContext));
return DIArray(MDNode::get(VMContext, Null));
}
- return DIArray(MDNode::get(VMContext,
- ArrayRef<Value*>(Elements, NumElements)));
+ return DIArray(MDNode::get(VMContext, Elements));
}
/// getOrCreateSubrange - Create a descriptor for a value range. This
@@ -649,8 +647,8 @@
DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope,
StringRef Name, DIFile F,
unsigned LineNo,
- DIType Ty, Value *const *Addr,
- unsigned NumAddr, unsigned ArgNo) {
+ DIType Ty, ArrayRef<Value *> Addr,
+ unsigned ArgNo) {
SmallVector<Value *, 15> Elts;
Elts.push_back(GetTagConstant(VMContext, Tag));
Elts.push_back(Scope);
@@ -658,7 +656,7 @@
Elts.push_back(F);
Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))));
Elts.push_back(Ty);
- Elts.append(Addr, Addr+NumAddr);
+ Elts.append(Addr.begin(), Addr.end());
return DIVariable(MDNode::get(VMContext, Elts));
}
More information about the llvm-commits
mailing list