[llvm] r304281 - [TableGen] Implement non-const versions of Record::getValue by delegating to the const versions to avoid duplicate code. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 22:12:36 PDT 2017
Author: ctopper
Date: Wed May 31 00:12:36 2017
New Revision: 304281
URL: http://llvm.org/viewvc/llvm-project?rev=304281&view=rev
Log:
[TableGen] Implement non-const versions of Record::getValue by delegating to the const versions to avoid duplicate code. NFC
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=304281&r1=304280&r2=304281&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Wed May 31 00:12:36 2017
@@ -1379,13 +1379,11 @@ public:
}
RecordVal *getValue(const Init *Name) {
- for (RecordVal &Val : Values)
- if (Val.Name == Name) return &Val;
- return nullptr;
+ return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
}
RecordVal *getValue(StringRef Name) {
- return getValue(StringInit::get(Name));
+ return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
}
void addTemplateArg(Init *Name) {
More information about the llvm-commits
mailing list