llvm.org GIT mirror llvm / 6855018
PR9214: Convert the DIBuilder API to use ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130086 91177308-0d34-0410-b5e6-96231b3b80d8 Jay Foad 9 years ago
2 changed file(s) with 11 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
1515 #define LLVM_ANALYSIS_DIBUILDER_H
1616
1717 #include "llvm/Support/DataTypes.h"
18 #include "llvm/ADT/ArrayRef.h"
1819 #include "llvm/ADT/StringRef.h"
1920
2021 namespace llvm {
301302 DIDescriptor createUnspecifiedParameter();
302303
303304 /// getOrCreateArray - Get a DIArray, create one if required.
304 DIArray getOrCreateArray(Value *const *Elements, unsigned NumElements);
305 DIArray getOrCreateArray(ArrayRef Elements);
305306
306307 /// getOrCreateSubrange - Create a descriptor for a value range. This
307308 /// implicitly uniques the values returned.
368369 /// @param File File where this variable is defined.
369370 /// @param LineNo Line number.
370371 /// @param Ty Variable Type
371 /// @param Addr A pointer to a vector of complex address operations.
372 /// @param NumAddr Num of address operations in the vector.
372 /// @param Addr An array of complex address operations.
373373 /// @param ArgNo If this variable is an arugment then this argument's
374374 /// number. 1 indicates 1st argument.
375375 DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
376376 StringRef Name, DIFile F, unsigned LineNo,
377 DIType Ty, Value *const *Addr,
378 unsigned NumAddr, unsigned ArgNo = 0);
377 DIType Ty, ArrayRef Addr,
378 unsigned ArgNo = 0);
379379
380380 /// createFunction - Create a new descriptor for the specified subprogram.
381381 /// See comments in DISubprogram for descriptions of these fields.
536536 }
537537
538538 /// getOrCreateArray - Get a DIArray, create one if required.
539 DIArray DIBuilder::getOrCreateArray(Value *const *Elements,
540 unsigned NumElements) {
541 if (NumElements == 0) {
539 DIArray DIBuilder::getOrCreateArray(ArrayRef Elements) {
540 if (Elements.empty()) {
542541 Value *Null = llvm::Constant::getNullValue(Type::getInt32Ty(VMContext));
543542 return DIArray(MDNode::get(VMContext, Null));
544543 }
545 return DIArray(MDNode::get(VMContext,
546 ArrayRef(Elements, NumElements)));
544 return DIArray(MDNode::get(VMContext, Elements));
547545 }
548546
549547 /// getOrCreateSubrange - Create a descriptor for a value range. This
648646 DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope,
649647 StringRef Name, DIFile F,
650648 unsigned LineNo,
651 DIType Ty, Value *const *Addr,
652 unsigned NumAddr, unsigned ArgNo) {
649 DIType Ty, ArrayRef Addr,
650 unsigned ArgNo) {
653651 SmallVector Elts;
654652 Elts.push_back(GetTagConstant(VMContext, Tag));
655653 Elts.push_back(Scope);
657655 Elts.push_back(F);
658656 Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))));
659657 Elts.push_back(Ty);
660 Elts.append(Addr, Addr+NumAddr);
658 Elts.append(Addr.begin(), Addr.end());
661659
662660 return DIVariable(MDNode::get(VMContext, Elts));
663661 }