[llvm] r226835 - Rename DIExpressionIterator to DIExpression::iterator.
Adrian Prantl
aprantl at apple.com
Thu Jan 22 08:55:20 PST 2015
Author: adrian
Date: Thu Jan 22 10:55:20 2015
New Revision: 226835
URL: http://llvm.org/viewvc/llvm-project?rev=226835&view=rev
Log:
Rename DIExpressionIterator to DIExpression::iterator.
Addresses review feedback from Duncan.
Modified:
llvm/trunk/include/llvm/IR/DebugInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=226835&r1=226834&r2=226835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Thu Jan 22 10:55:20 2015
@@ -850,8 +850,6 @@ public:
void printExtendedName(raw_ostream &OS) const;
};
-class DIExpressionIterator;
-
/// \brief A complex location expression.
class DIExpression : public DIDescriptor {
friend class DIDescriptor;
@@ -881,56 +879,55 @@ public:
/// \brief Return the size of this piece in bytes.
uint64_t getPieceSize() const;
- DIExpressionIterator begin() const;
- DIExpressionIterator end() const;
-};
-
-/// \brief An iterator for DIExpression elments.
-class DIExpressionIterator
- : public std::iterator<std::forward_iterator_tag, StringRef, unsigned,
- const uint64_t *, uint64_t> {
- DIHeaderFieldIterator I;
- DIExpressionIterator(DIHeaderFieldIterator I) : I(I) {}
-public:
- DIExpressionIterator() {}
- DIExpressionIterator(const DIExpression &Expr) : I(++Expr.header_begin()) {}
- uint64_t operator*() const { return I.getNumber<uint64_t>(); }
- DIExpressionIterator &operator++() {
- increment();
- return *this;
- }
- DIExpressionIterator operator++(int) {
- DIExpressionIterator X(*this);
- increment();
- return X;
- }
- bool operator==(const DIExpressionIterator &X) const {
- return I == X.I;
- }
- bool operator!=(const DIExpressionIterator &X) const {
- return !(*this == X);
- }
-
- uint64_t getArg(unsigned N) const {
- auto In = I;
- std::advance(In, N);
- return In.getNumber<uint64_t>();
- }
-
- const DIHeaderFieldIterator& getBase() const { return I; }
-
-private:
- void increment() {
- switch (**this) {
- case dwarf::DW_OP_piece: std::advance(I, 3); break;
- case dwarf::DW_OP_plus: std::advance(I, 2); break;
- case dwarf::DW_OP_deref: std::advance(I, 1); break;
- default:
- assert("unsupported operand");
+ /// \brief An iterator for DIExpression elements.
+ class iterator
+ : public std::iterator<std::forward_iterator_tag, StringRef, unsigned,
+ const uint64_t *, uint64_t> {
+ DIHeaderFieldIterator I;
+ iterator(DIHeaderFieldIterator I) : I(I) {}
+ public:
+ iterator() {}
+ iterator(const DIExpression &Expr) : I(++Expr.header_begin()) {}
+ uint64_t operator*() const { return I.getNumber<uint64_t>(); }
+ iterator &operator++() {
+ increment();
+ return *this;
}
- }
-};
+ iterator operator++(int) {
+ iterator X(*this);
+ increment();
+ return X;
+ }
+ bool operator==(const iterator &X) const {
+ return I == X.I;
+ }
+ bool operator!=(const iterator &X) const {
+ return !(*this == X);
+ }
+
+ uint64_t getArg(unsigned N) const {
+ auto In = I;
+ std::advance(In, N);
+ return In.getNumber<uint64_t>();
+ }
+
+ const DIHeaderFieldIterator& getBase() const { return I; }
+
+ private:
+ void increment() {
+ switch (**this) {
+ case dwarf::DW_OP_piece: std::advance(I, 3); break;
+ case dwarf::DW_OP_plus: std::advance(I, 2); break;
+ case dwarf::DW_OP_deref: std::advance(I, 1); break;
+ default:
+ assert("unsupported operand");
+ }
+ }
+ };
+ iterator begin() const;
+ iterator end() const;
+};
/// \brief This object holds location information.
///
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp?rev=226835&r1=226834&r2=226835&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp Thu Jan 22 10:55:20 2015
@@ -242,9 +242,9 @@ bool DwarfExpression::AddMachineRegExpre
return true;
}
-void DwarfExpression::AddExpression(DIExpressionIterator I,
+void DwarfExpression::AddExpression(DIExpression::iterator I,
unsigned PieceOffsetInBits) {
- for (; I != DIExpressionIterator(); ++I) {
+ for (; I != DIExpression::iterator(); ++I) {
switch (*I) {
case dwarf::DW_OP_piece: {
unsigned SizeOfByte = 8;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h?rev=226835&r1=226834&r2=226835&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h Thu Jan 22 10:55:20 2015
@@ -96,7 +96,7 @@ public:
/// Emit a the operations remaining the DIExpressionIterator I.
/// \param PieceOffsetInBits If this is one piece out of a fragmented
/// location, this is the offset of the piece inside the entire variable.
- void AddExpression(DIExpressionIterator I, unsigned PieceOffsetInBits = 0);
+void AddExpression(DIExpression::iterator I, unsigned PieceOffsetInBits = 0);
};
/// DwarfExpression implementation for .debug_loc entries.
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=226835&r1=226834&r2=226835&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Thu Jan 22 10:55:20 2015
@@ -162,12 +162,12 @@ uint64_t DIExpression::getPieceSize() co
return getElement(getNumElements()-1);
}
-DIExpressionIterator DIExpression::begin() const {
- return DIExpressionIterator(*this);
+DIExpression::iterator DIExpression::begin() const {
+ return DIExpression::iterator(*this);
}
-DIExpressionIterator DIExpression::end() const {
- return DIExpressionIterator();
+DIExpression::iterator DIExpression::end() const {
+ return DIExpression::iterator();
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list