//===----------------------------------------------------------------------===//
#include "TGParser.h"
-#include "llvm/TableGen/Record.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/TableGen/Record.h"
#include <algorithm>
#include <sstream>
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/CommandLine.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
RecTy *Type = 0;
if (CurRec) {
- const TypedInit *CurRecName =
- dyn_cast<TypedInit>(CurRec->getNameInit());
+ const TypedInit *CurRecName = dyn_cast<TypedInit>(CurRec->getNameInit());
if (!CurRecName) {
TokError("Record name is not typed!");
return 0;
MHSTy = MHSt->getType();
if (BitsInit *MHSbits = dyn_cast<BitsInit>(MHS))
MHSTy = BitsRecTy::get(MHSbits->getNumBits());
- if (dyn_cast<BitInit>(MHS))
+ if (isa<BitInit>(MHS))
MHSTy = BitRecTy::get();
if (TypedInit *RHSt = dyn_cast<TypedInit>(RHS))
RHSTy = RHSt->getType();
if (BitsInit *RHSbits = dyn_cast<BitsInit>(RHS))
RHSTy = BitsRecTy::get(RHSbits->getNumBits());
- if (dyn_cast<BitInit>(RHS))
+ if (isa<BitInit>(RHS))
RHSTy = BitRecTy::get();
// For UnsetInit, it's typed from the other hand.
- if (dyn_cast<UnsetInit>(MHS))
+ if (isa<UnsetInit>(MHS))
MHSTy = RHSTy;
- if (dyn_cast<UnsetInit>(RHS))
+ if (isa<UnsetInit>(RHS))
RHSTy = MHSTy;
if (!MHSTy || !RHSTy) {
Init *DefmPrefix = 0;
- if (Lex.Lex() == tgtok::Id) { // eat the defm.
+ Lex.Lex(); // eat the defm.
+
+ // Note that tgtok::paste is here to allow starting with #NAME.
+ if (Lex.getCode() == tgtok::Id ||
+ Lex.getCode() == tgtok::paste) {
DefmPrefix = ParseObjectName(CurMultiClass);
}