File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,19 @@ using namespace llvm;
31
31
32
32
#define DEBUG_TYPE " searchable-table-emitter"
33
33
34
- namespace {
35
-
36
- int64_t getAsInt (Init *B) {
37
- return cast <IntInit>(
38
- B-> convertInitializerTo ( IntRecTy::get (B-> getRecordKeeper ())))
39
- -> getValue ( );
34
+ static int64_t getAsInt ( const Init *B) {
35
+ if ( const BitsInit *BI = dyn_cast<BitsInit>(B))
36
+ return *BI-> convertInitializerToInt ();
37
+ if ( const IntInit *II = dyn_cast <IntInit>(B))
38
+ return II-> getValue ();
39
+ llvm_unreachable ( " Unexpected initializer " );
40
40
}
41
- int64_t getInt (Record *R, StringRef Field) {
41
+
42
+ static int64_t getInt (const Record *R, StringRef Field) {
42
43
return getAsInt (R->getValueInit (Field));
43
44
}
44
45
46
+ namespace {
45
47
struct GenericEnum {
46
48
using Entry = std::pair<StringRef, int64_t >;
47
49
You can’t perform that action at this time.
0 commit comments