[llvm] r304280 - [TableGen] Make one of RecordVal's constructors delegate to the other to reduce duplicate code.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 22:12:34 PDT 2017


Author: ctopper
Date: Wed May 31 00:12:33 2017
New Revision: 304280

URL: http://llvm.org/viewvc/llvm-project?rev=304280&view=rev
Log:
[TableGen] Make one of RecordVal's constructors delegate to the other to reduce duplicate code.

Modified:
    llvm/trunk/include/llvm/TableGen/Record.h
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=304280&r1=304279&r2=304280&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Wed May 31 00:12:33 2017
@@ -1237,7 +1237,8 @@ class RecordVal {
 
 public:
   RecordVal(Init *N, RecTy *T, bool P);
-  RecordVal(StringRef N, RecTy *T, bool P);
+  RecordVal(StringRef N, RecTy *T, bool P)
+    : RecordVal(StringInit::get(N), T, P) {}
 
   StringRef getName() const;
   Init *getNameInit() const { return Name; }

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=304280&r1=304279&r2=304280&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Wed May 31 00:12:33 2017
@@ -1572,12 +1572,6 @@ RecordVal::RecordVal(Init *N, RecTy *T,
   assert(Value && "Cannot create unset value for current type!");
 }
 
-RecordVal::RecordVal(StringRef N, RecTy *T, bool P)
-  : Name(StringInit::get(N)), TyAndPrefix(T, P) {
-  Value = UnsetInit::get()->convertInitializerTo(T);
-  assert(Value && "Cannot create unset value for current type!");
-}
-
 StringRef RecordVal::getName() const {
   return cast<StringInit>(getNameInit())->getValue();
 }




More information about the llvm-commits mailing list