[llvm] r304177 - [TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to fix 80 column violations in arg_begin/arg_end. Remove DagInit::args and use getArgs instead. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon May 29 14:49:35 PDT 2017
Author: ctopper
Date: Mon May 29 16:49:34 2017
New Revision: 304177
URL: http://llvm.org/viewvc/llvm-project?rev=304177&view=rev
Log:
[TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to fix 80 column violations in arg_begin/arg_end. Remove DagInit::args and use getArgs instead. NFC
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
llvm/trunk/lib/TableGen/Record.cpp
llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=304177&r1=304176&r2=304177&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Mon May 29 16:49:34 2017
@@ -1189,6 +1189,9 @@ public:
return Init ? Init->getValue() : StringRef();
}
+ ArrayRef<Init *> getArgs() const {
+ return makeArrayRef(getTrailingObjects<Init *>(), NumArgs);
+ }
ArrayRef<StringInit *> getArgNames() const {
return makeArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
}
@@ -1200,19 +1203,16 @@ public:
typedef SmallVectorImpl<Init*>::const_iterator const_arg_iterator;
typedef SmallVectorImpl<StringInit*>::const_iterator const_name_iterator;
- inline const_arg_iterator arg_begin() const { return getTrailingObjects<Init *>(); }
- inline const_arg_iterator arg_end () const { return arg_begin() + NumArgs; }
- inline iterator_range<const_arg_iterator> args() const {
- return llvm::make_range(arg_begin(), arg_end());
- }
+ inline const_arg_iterator arg_begin() const { return getArgs().begin(); }
+ inline const_arg_iterator arg_end () const { return getArgs().end(); }
- inline size_t arg_size () const { return NumArgs; }
+ inline size_t arg_size () const { return NumArgs; }
inline bool arg_empty() const { return NumArgs == 0; }
- inline const_name_iterator name_begin() const { return getTrailingObjects<StringInit *>(); }
- inline const_name_iterator name_end () const { return name_begin() + NumArgNames; }
+ inline const_name_iterator name_begin() const { return getArgNames().begin();}
+ inline const_name_iterator name_end () const { return getArgNames().end(); }
- inline size_t name_size () const { return NumArgNames; }
+ inline size_t name_size () const { return NumArgNames; }
inline bool name_empty() const { return NumArgNames == 0; }
Init *getBit(unsigned Bit) const override {
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=304177&r1=304176&r2=304177&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Mon May 29 16:49:34 2017
@@ -1540,7 +1540,7 @@ Init *DagInit::resolveReferences(Record
SmallVector<Init*, 8> NewArgs;
NewArgs.reserve(arg_size());
bool ArgsChanged = false;
- for (const Init *Arg : args()) {
+ for (const Init *Arg : getArgs()) {
Init *NewArg = Arg->resolveReferences(R, RV);
NewArgs.push_back(NewArg);
ArgsChanged |= NewArg != Arg;
Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=304177&r1=304176&r2=304177&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Mon May 29 16:49:34 2017
@@ -1602,7 +1602,7 @@ Expected<BuildMIAction &> GlobalISelEmit
Error GlobalISelEmitter::importDefaultOperandRenderers(
BuildMIAction &DstMIBuilder, DagInit *DefaultOps) const {
- for (const auto *DefaultOp : DefaultOps->args()) {
+ for (const auto *DefaultOp : DefaultOps->getArgs()) {
// Look through ValueType operators.
if (const DagInit *DefaultDagOp = dyn_cast<DagInit>(DefaultOp)) {
if (const DefInit *DefaultDagOperator =
More information about the llvm-commits
mailing list