projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix c++ mode comments
[oota-llvm.git]
/
include
/
llvm
/
Analysis
/
ConstantsScanner.h
diff --git
a/include/llvm/Analysis/ConstantsScanner.h
b/include/llvm/Analysis/ConstantsScanner.h
index 1d7167673248c4c37ba338d1429182c5eb97abbe..cdaf68d75a6399fac3c35648f3ce8ae79b1cceea 100644
(file)
--- a/
include/llvm/Analysis/ConstantsScanner.h
+++ b/
include/llvm/Analysis/ConstantsScanner.h
@@
-1,7
+1,14
@@
//==- llvm/Analysis/ConstantsScanner.h - Iterate over constants -*- C++ -*-===//
//
//==- llvm/Analysis/ConstantsScanner.h - Iterate over constants -*- C++ -*-===//
//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
// This class implements an iterator to walk through the constants referenced by
// This class implements an iterator to walk through the constants referenced by
-// a method. This is used by the B
yte
code & Assembly writers to build constant
+// a method. This is used by the B
it
code & Assembly writers to build constant
// pools.
//
//===----------------------------------------------------------------------===//
// pools.
//
//===----------------------------------------------------------------------===//
@@
-10,11
+17,13
@@
#define LLVM_ANALYSIS_CONSTANTSSCANNER_H
#include "llvm/Support/InstIterator.h"
#define LLVM_ANALYSIS_CONSTANTSSCANNER_H
#include "llvm/Support/InstIterator.h"
-#include "llvm/Instruction.h"
-#include "Support/iterator"
+
+namespace llvm {
+
class Constant;
class Constant;
-class constant_iterator : public forward_iterator<const Constant, ptrdiff_t> {
+class constant_iterator : public std::iterator<std::forward_iterator_tag,
+ const Constant, ptrdiff_t> {
const_inst_iterator InstI; // Method instruction iterator
unsigned OpIdx; // Operand index
const_inst_iterator InstI; // Method instruction iterator
unsigned OpIdx; // Operand index
@@
-22,7
+31,7
@@
class constant_iterator : public forward_iterator<const Constant, ptrdiff_t> {
inline bool isAtConstant() const {
assert(!InstI.atEnd() && OpIdx < InstI->getNumOperands() &&
inline bool isAtConstant() const {
assert(!InstI.atEnd() && OpIdx < InstI->getNumOperands() &&
- "isAtConstant called with invalid arguments!");
+
"isAtConstant called with invalid arguments!");
return isa<Constant>(InstI->getOperand(OpIdx));
}
return isa<Constant>(InstI->getOperand(OpIdx));
}
@@
-30,7
+39,7
@@
public:
inline constant_iterator(const Function *F) : InstI(inst_begin(F)), OpIdx(0) {
// Advance to first constant... if we are not already at constant or end
if (InstI != inst_end(F) && // InstI is valid?
inline constant_iterator(const Function *F) : InstI(inst_begin(F)), OpIdx(0) {
// Advance to first constant... if we are not already at constant or end
if (InstI != inst_end(F) && // InstI is valid?
- (InstI->getNumOperands() == 0 || !isAtConstant())) // Not at constant?
+
(InstI->getNumOperands() == 0 || !isAtConstant())) // Not at constant?
operator++();
}
operator++();
}
@@
-38,8
+47,8
@@
public:
: InstI(inst_end(F)), OpIdx(0) {
}
: InstI(inst_end(F)), OpIdx(0) {
}
- inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
- InstI == x.InstI; }
+ inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
+
InstI == x.InstI; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
inline pointer operator*() const {
inline bool operator!=(const _Self& x) const { return !operator==(x); }
inline pointer operator*() const {
@@
-53,7
+62,7
@@
public:
do {
unsigned NumOperands = InstI->getNumOperands();
while (OpIdx < NumOperands && !isAtConstant()) {
do {
unsigned NumOperands = InstI->getNumOperands();
while (OpIdx < NumOperands && !isAtConstant()) {
- ++OpIdx;
+
++OpIdx;
}
if (OpIdx < NumOperands) return *this; // Found a constant!
}
if (OpIdx < NumOperands) return *this; // Found a constant!
@@
-65,7
+74,7
@@
public:
}
inline _Self operator++(int) { // Postincrement
}
inline _Self operator++(int) { // Postincrement
- _Self tmp = *this; ++*this; return tmp;
+ _Self tmp = *this; ++*this; return tmp;
}
inline bool atEnd() const { return InstI.atEnd(); }
}
inline bool atEnd() const { return InstI.atEnd(); }
@@
-79,4
+88,6
@@
inline constant_iterator constant_end(const Function *F) {
return constant_iterator(F, true);
}
return constant_iterator(F, true);
}
+} // End llvm namespace
+
#endif
#endif