diff options
Diffstat (limited to 'include/llvm/TableGen')
-rw-r--r-- | include/llvm/TableGen/Error.h | 1 | ||||
-rw-r--r-- | include/llvm/TableGen/Main.h | 1 | ||||
-rw-r--r-- | include/llvm/TableGen/Record.h | 184 | ||||
-rw-r--r-- | include/llvm/TableGen/StringMatcher.h | 12 | ||||
-rw-r--r-- | include/llvm/TableGen/StringToOffsetTable.h | 10 |
5 files changed, 102 insertions, 106 deletions
diff --git a/include/llvm/TableGen/Error.h b/include/llvm/TableGen/Error.h index 17ac418..3df658d 100644 --- a/include/llvm/TableGen/Error.h +++ b/include/llvm/TableGen/Error.h @@ -34,7 +34,6 @@ LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, extern SourceMgr SrcMgr; extern unsigned ErrorsPrinted; - } // end namespace "llvm" #endif diff --git a/include/llvm/TableGen/Main.h b/include/llvm/TableGen/Main.h index 6b51e20..866b986 100644 --- a/include/llvm/TableGen/Main.h +++ b/include/llvm/TableGen/Main.h @@ -23,7 +23,6 @@ class raw_ostream; typedef bool TableGenMainFn(raw_ostream &OS, RecordKeeper &Records); int TableGenMain(char *argv0, TableGenMainFn *MainFn); - } #endif diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h index 2bed006..36464d7 100644 --- a/include/llvm/TableGen/Record.h +++ b/include/llvm/TableGen/Record.h @@ -87,7 +87,7 @@ private: public: RecTyKind getRecTyKind() const { return Kind; } - RecTy(RecTyKind K) : Kind(K), ListTy(0) {} + RecTy(RecTyKind K) : Kind(K), ListTy(nullptr) {} virtual ~RecTy() {} virtual std::string getAsString() const = 0; @@ -102,12 +102,12 @@ public: ListRecTy *getListTy(); public: // These methods should only be called from subclasses of Init - virtual Init *convertValue( UnsetInit *UI) { return 0; } - virtual Init *convertValue( BitInit *BI) { return 0; } - virtual Init *convertValue( BitsInit *BI) { return 0; } - virtual Init *convertValue( IntInit *II) { return 0; } - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } + virtual Init *convertValue( UnsetInit *UI) { return nullptr; } + virtual Init *convertValue( BitInit *BI) { return nullptr; } + virtual Init *convertValue( BitsInit *BI) { return nullptr; } + virtual Init *convertValue( IntInit *II) { return nullptr; } + virtual Init *convertValue(StringInit *SI) { return nullptr; } + virtual Init *convertValue( ListInit *LI) { return nullptr; } virtual Init *convertValue( UnOpInit *UI) { return convertValue((TypedInit*)UI); } @@ -117,10 +117,10 @@ public: // These methods should only be called from subclasses of Init virtual Init *convertValue( TernOpInit *UI) { return convertValue((TypedInit*)UI); } - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( TypedInit *TI) { return 0; } + virtual Init *convertValue(VarBitInit *VB) { return nullptr; } + virtual Init *convertValue( DefInit *DI) { return nullptr; } + virtual Init *convertValue( DagInit *DI) { return nullptr; } + virtual Init *convertValue( TypedInit *TI) { return nullptr; } virtual Init *convertValue( VarInit *VI) { return convertValue((TypedInit*)VI); } @@ -137,12 +137,12 @@ inline raw_ostream &operator<<(raw_ostream &OS, const RecTy &Ty) { return OS; } - /// BitRecTy - 'bit' - Represent a single bit /// class BitRecTy : public RecTy { static BitRecTy Shared; BitRecTy() : RecTy(BitRecTyKind) {} + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == BitRecTyKind; @@ -154,11 +154,11 @@ public: Init *convertValue( BitInit *BI) override { return (Init*)BI; } Init *convertValue( BitsInit *BI) override; Init *convertValue( IntInit *II) override; - Init *convertValue(StringInit *SI) override { return 0; } - Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(StringInit *SI) override { return nullptr; } + Init *convertValue( ListInit *LI) override { return nullptr; } Init *convertValue(VarBitInit *VB) override { return (Init*)VB; } - Init *convertValue( DefInit *DI) override { return 0; } - Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( DefInit *DI) override { return nullptr; } + Init *convertValue( DagInit *DI) override { return nullptr; } Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} @@ -174,12 +174,12 @@ public: bool baseClassOf(const RecTy*) const override; }; - /// BitsRecTy - 'bits<n>' - Represent a fixed number of bits /// class BitsRecTy : public RecTy { unsigned Size; explicit BitsRecTy(unsigned Sz) : RecTy(BitsRecTyKind), Size(Sz) {} + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == BitsRecTyKind; @@ -193,32 +193,32 @@ public: Init *convertValue( BitInit *UI) override; Init *convertValue( BitsInit *BI) override; Init *convertValue( IntInit *II) override; - Init *convertValue(StringInit *SI) override { return 0; } - Init *convertValue( ListInit *LI) override { return 0; } - Init *convertValue(VarBitInit *VB) override { return 0; } - Init *convertValue( DefInit *DI) override { return 0; } - Init *convertValue( DagInit *DI) override { return 0; } - Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue(StringInit *SI) override { return nullptr; } + Init *convertValue( ListInit *LI) override { return nullptr; } + Init *convertValue(VarBitInit *VB) override { return nullptr; } + Init *convertValue( DefInit *DI) override { return nullptr; } + Init *convertValue( DagInit *DI) override { return nullptr; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} - Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} + Init *convertValue(TernOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( TypedInit *TI) override; - Init *convertValue( VarInit *VI) override{ return RecTy::convertValue(VI);} - Init *convertValue( FieldInit *FI) override{ return RecTy::convertValue(FI);} + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} std::string getAsString() const override; - bool typeIsConvertibleTo(const RecTy *RHS) const override{ + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } bool baseClassOf(const RecTy*) const override; }; - /// IntRecTy - 'int' - Represent an integer value of no particular size /// class IntRecTy : public RecTy { static IntRecTy Shared; IntRecTy() : RecTy(IntRecTyKind) {} + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == IntRecTyKind; @@ -230,11 +230,11 @@ public: Init *convertValue( BitInit *BI) override; Init *convertValue( BitsInit *BI) override; Init *convertValue( IntInit *II) override { return (Init*)II; } - Init *convertValue(StringInit *SI) override { return 0; } - Init *convertValue( ListInit *LI) override { return 0; } - Init *convertValue(VarBitInit *VB) override { return 0; } - Init *convertValue( DefInit *DI) override { return 0; } - Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue(StringInit *SI) override { return nullptr; } + Init *convertValue( ListInit *LI) override { return nullptr; } + Init *convertValue(VarBitInit *VB) override { return nullptr; } + Init *convertValue( DefInit *DI) override { return nullptr; } + Init *convertValue( DagInit *DI) override { return nullptr; } Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} @@ -256,6 +256,7 @@ public: class StringRecTy : public RecTy { static StringRecTy Shared; StringRecTy() : RecTy(StringRecTyKind) {} + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == StringRecTyKind; @@ -264,18 +265,18 @@ public: static StringRecTy *get() { return &Shared; } Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } - Init *convertValue( BitInit *BI) override { return 0; } - Init *convertValue( BitsInit *BI) override { return 0; } - Init *convertValue( IntInit *II) override { return 0; } + Init *convertValue( BitInit *BI) override { return nullptr; } + Init *convertValue( BitsInit *BI) override { return nullptr; } + Init *convertValue( IntInit *II) override { return nullptr; } Init *convertValue(StringInit *SI) override { return (Init*)SI; } - Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue( ListInit *LI) override { return nullptr; } Init *convertValue( UnOpInit *BO) override; Init *convertValue( BinOpInit *BO) override; Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);} - Init *convertValue(VarBitInit *VB) override { return 0; } - Init *convertValue( DefInit *DI) override { return 0; } - Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return nullptr; } + Init *convertValue( DefInit *DI) override { return nullptr; } + Init *convertValue( DagInit *DI) override { return nullptr; } Init *convertValue( TypedInit *TI) override; Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} @@ -294,6 +295,7 @@ class ListRecTy : public RecTy { RecTy *Ty; explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), Ty(T) {} friend ListRecTy *RecTy::getListTy(); + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == ListRecTyKind; @@ -303,24 +305,24 @@ public: RecTy *getElementType() const { return Ty; } Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } - Init *convertValue( BitInit *BI) override { return 0; } - Init *convertValue( BitsInit *BI) override { return 0; } - Init *convertValue( IntInit *II) override { return 0; } - Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( BitInit *BI) override { return nullptr; } + Init *convertValue( BitsInit *BI) override { return nullptr; } + Init *convertValue( IntInit *II) override { return nullptr; } + Init *convertValue(StringInit *SI) override { return nullptr; } Init *convertValue( ListInit *LI) override; - Init *convertValue(VarBitInit *VB) override { return 0; } - Init *convertValue( DefInit *DI) override { return 0; } - Init *convertValue( DagInit *DI) override { return 0; } - Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue(VarBitInit *VB) override { return nullptr; } + Init *convertValue( DefInit *DI) override { return nullptr; } + Init *convertValue( DagInit *DI) override { return nullptr; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} - Init *convertValue( TernOpInit *UI) override{ return RecTy::convertValue(UI);} + Init *convertValue(TernOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( TypedInit *TI) override; Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} std::string getAsString() const override; - bool typeIsConvertibleTo(const RecTy *RHS) const override{ + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } @@ -332,6 +334,7 @@ public: class DagRecTy : public RecTy { static DagRecTy Shared; DagRecTy() : RecTy(DagRecTyKind) {} + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == DagRecTyKind; @@ -340,13 +343,13 @@ public: static DagRecTy *get() { return &Shared; } Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } - Init *convertValue( BitInit *BI) override { return 0; } - Init *convertValue( BitsInit *BI) override { return 0; } - Init *convertValue( IntInit *II) override { return 0; } - Init *convertValue(StringInit *SI) override { return 0; } - Init *convertValue( ListInit *LI) override { return 0; } - Init *convertValue(VarBitInit *VB) override { return 0; } - Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( BitInit *BI) override { return nullptr; } + Init *convertValue( BitsInit *BI) override { return nullptr; } + Init *convertValue( IntInit *II) override { return nullptr; } + Init *convertValue(StringInit *SI) override { return nullptr; } + Init *convertValue( ListInit *LI) override { return nullptr; } + Init *convertValue(VarBitInit *VB) override { return nullptr; } + Init *convertValue( DefInit *DI) override { return nullptr; } Init *convertValue( UnOpInit *BO) override; Init *convertValue( BinOpInit *BO) override; Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);} @@ -357,12 +360,11 @@ public: std::string getAsString() const override { return "dag"; } - bool typeIsConvertibleTo(const RecTy *RHS) const override{ + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } }; - /// RecordRecTy - '[classname]' - Represent an instance of a class, such as: /// (R32 X = EAX). /// @@ -370,6 +372,7 @@ class RecordRecTy : public RecTy { Record *Rec; explicit RecordRecTy(Record *R) : RecTy(RecordRecTyKind), Rec(R) {} friend class Record; + public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == RecordRecTyKind; @@ -380,17 +383,17 @@ public: Record *getRecord() const { return Rec; } Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } - Init *convertValue( BitInit *BI) override { return 0; } - Init *convertValue( BitsInit *BI) override { return 0; } - Init *convertValue( IntInit *II) override { return 0; } - Init *convertValue(StringInit *SI) override { return 0; } - Init *convertValue( ListInit *LI) override { return 0; } - Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( BitInit *BI) override { return nullptr; } + Init *convertValue( BitsInit *BI) override { return nullptr; } + Init *convertValue( IntInit *II) override { return nullptr; } + Init *convertValue(StringInit *SI) override { return nullptr; } + Init *convertValue( ListInit *LI) override { return nullptr; } + Init *convertValue(VarBitInit *VB) override { return nullptr; } Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} Init *convertValue( DefInit *DI) override; - Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return nullptr; } Init *convertValue( TypedInit *VI) override; Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} @@ -496,7 +499,7 @@ public: /// virtual Init * convertInitializerBitRange(const std::vector<unsigned> &Bits) const { - return 0; + return nullptr; } /// convertInitListSlice - This method is used to implement the list slice @@ -506,14 +509,16 @@ public: /// virtual Init * convertInitListSlice(const std::vector<unsigned> &Elements) const { - return 0; + return nullptr; } /// getFieldType - This method is used to implement the FieldInit class. /// Implementors of this method should return the type of the named field if /// they are of record type. /// - virtual RecTy *getFieldType(const std::string &FieldName) const { return 0; } + virtual RecTy *getFieldType(const std::string &FieldName) const { + return nullptr; + } /// getFieldInit - This method complements getFieldType to return the /// initializer for the specified field. If getFieldType returns non-null @@ -521,7 +526,7 @@ public: /// virtual Init *getFieldInit(Record &R, const RecordVal *RV, const std::string &FieldName) const { - return 0; + return nullptr; } /// resolveReferences - This method is used by classes that refer to other @@ -587,7 +592,6 @@ public: unsigned Elt) const = 0; }; - /// UnsetInit - ? - Represents an uninitialized value /// class UnsetInit : public Init { @@ -614,7 +618,6 @@ public: std::string getAsString() const override { return "?"; } }; - /// BitInit - true/false - Represent a concrete initializer for a bit. /// class BitInit : public Init { @@ -693,7 +696,6 @@ public: } }; - /// IntInit - 7 - Represent an initialization by a literal integer value. /// class IntInit : public TypedInit { @@ -734,7 +736,6 @@ public: } }; - /// StringInit - "foo" - Represent an initialization by a string value. /// class StringInit : public TypedInit { @@ -779,6 +780,7 @@ public: /// class ListInit : public TypedInit, public FoldingSetNode { std::vector<Init*> Values; + public: typedef std::vector<Init*>::const_iterator const_iterator; @@ -841,7 +843,6 @@ public: } }; - /// OpInit - Base class for operators /// class OpInit : public TypedInit { @@ -876,12 +877,12 @@ public: Init *getBit(unsigned Bit) const override; }; - /// UnOpInit - !op (X) - Transform an init. /// class UnOpInit : public OpInit { public: enum UnaryOp { CAST, HEAD, TAIL, EMPTY }; + private: UnaryOp Opc; Init *LHS; @@ -927,7 +928,8 @@ public: /// class BinOpInit : public OpInit { public: - enum BinaryOp { ADD, SHL, SRA, SRL, STRCONCAT, CONCAT, EQ }; + enum BinaryOp { ADD, SHL, SRA, SRL, LISTCONCAT, STRCONCAT, CONCAT, EQ }; + private: BinaryOp Opc; Init *LHS, *RHS; @@ -980,6 +982,7 @@ public: class TernOpInit : public OpInit { public: enum TernaryOp { SUBST, FOREACH, IF }; + private: TernaryOp Opc; Init *LHS, *MHS, *RHS; @@ -1036,7 +1039,6 @@ public: std::string getAsString() const override; }; - /// VarInit - 'Opcode' - Represent a reference to an entire variable object. /// class VarInit : public TypedInit { @@ -1086,7 +1088,6 @@ public: std::string getAsString() const override { return getName(); } }; - /// VarBitInit - Opcode{0} - Represent access to one bit of a variable or field. /// class VarBitInit : public Init { @@ -1212,7 +1213,6 @@ public: } }; - /// FieldInit - X.Y - Represent a reference to a subfield of a variable /// class FieldInit : public TypedInit { @@ -1339,6 +1339,7 @@ class RecordVal { RecTy *Ty; unsigned Prefix; Init *Value; + public: RecordVal(Init *N, RecTy *T, unsigned P); RecordVal(const std::string &N, RecTy *T, unsigned P); @@ -1356,9 +1357,9 @@ public: bool setValue(Init *V) { if (V) { Value = V->convertInitializerTo(Ty); - return Value == 0; + return Value == nullptr; } - Value = 0; + Value = nullptr; return false; } @@ -1395,18 +1396,17 @@ class Record { void checkName(); public: - // Constructs a record. explicit Record(const std::string &N, ArrayRef<SMLoc> locs, RecordKeeper &records, bool Anonymous = false) : ID(LastID++), Name(StringInit::get(N)), Locs(locs.begin(), locs.end()), - TrackedRecords(records), TheInit(0), IsAnonymous(Anonymous) { + TrackedRecords(records), TheInit(nullptr), IsAnonymous(Anonymous) { init(); } explicit Record(Init *N, ArrayRef<SMLoc> locs, RecordKeeper &records, bool Anonymous = false) : ID(LastID++), Name(N), Locs(locs.begin(), locs.end()), - TrackedRecords(records), TheInit(0), IsAnonymous(Anonymous) { + TrackedRecords(records), TheInit(nullptr), IsAnonymous(Anonymous) { init(); } @@ -1420,10 +1420,8 @@ public: ~Record() {} - static unsigned getNewUID() { return LastID++; } - unsigned getID() const { return ID; } const std::string &getName() const; @@ -1461,7 +1459,7 @@ public: const RecordVal *getValue(const Init *Name) const { for (unsigned i = 0, e = Values.size(); i != e; ++i) if (Values[i].getNameInit() == Name) return &Values[i]; - return 0; + return nullptr; } const RecordVal *getValue(StringRef Name) const { return getValue(StringInit::get(Name)); @@ -1469,7 +1467,7 @@ public: RecordVal *getValue(const Init *Name) { for (unsigned i = 0, e = Values.size(); i != e; ++i) if (Values[i].getNameInit() == Name) return &Values[i]; - return 0; + return nullptr; } RecordVal *getValue(StringRef Name) { return getValue(StringInit::get(Name)); @@ -1484,7 +1482,7 @@ public: } void addValue(const RecordVal &RV) { - assert(getValue(RV.getNameInit()) == 0 && "Value already added!"); + assert(getValue(RV.getNameInit()) == nullptr && "Value already added!"); Values.push_back(RV); if (Values.size() > 1) // Keep NAME at the end of the list. It makes record dumps a @@ -1531,7 +1529,7 @@ public: /// resolveReferences - If there are any field references that refer to fields /// that have been filled in, we can propagate the values now. /// - void resolveReferences() { resolveReferencesTo(0); } + void resolveReferences() { resolveReferencesTo(nullptr); } /// resolveReferencesTo - If anything in this record refers to RV, replace the /// reference to RV with the RHS of RV. If RV is null, we resolve all @@ -1660,11 +1658,11 @@ public: Record *getClass(const std::string &Name) const { std::map<std::string, Record*>::const_iterator I = Classes.find(Name); - return I == Classes.end() ? 0 : I->second; + return I == Classes.end() ? nullptr : I->second; } Record *getDef(const std::string &Name) const { std::map<std::string, Record*>::const_iterator I = Defs.find(Name); - return I == Defs.end() ? 0 : I->second; + return I == Defs.end() ? nullptr : I->second; } void addClass(Record *R) { bool Ins = Classes.insert(std::make_pair(R->getName(), R)).second; diff --git a/include/llvm/TableGen/StringMatcher.h b/include/llvm/TableGen/StringMatcher.h index 99cbcad..b438779 100644 --- a/include/llvm/TableGen/StringMatcher.h +++ b/include/llvm/TableGen/StringMatcher.h @@ -21,29 +21,29 @@ namespace llvm { class raw_ostream; - + /// StringMatcher - Given a list of strings and code to execute when they match, /// output a simple switch tree to classify the input string. -/// +/// /// If a match is found, the code in Vals[i].second is executed; control must /// not exit this code fragment. If nothing matches, execution falls through. /// class StringMatcher { public: typedef std::pair<std::string, std::string> StringPair; + private: StringRef StrVariableName; const std::vector<StringPair> &Matches; raw_ostream &OS; - + public: StringMatcher(StringRef strVariableName, const std::vector<StringPair> &matches, raw_ostream &os) : StrVariableName(strVariableName), Matches(matches), OS(os) {} - + void Emit(unsigned Indent = 0) const; - - + private: bool EmitStringMatcherForChar(const std::vector<const StringPair*> &Matches, unsigned CharNo, unsigned IndentCount) const; diff --git a/include/llvm/TableGen/StringToOffsetTable.h b/include/llvm/TableGen/StringToOffsetTable.h index d94d3a2..c924bd8 100644 --- a/include/llvm/TableGen/StringToOffsetTable.h +++ b/include/llvm/TableGen/StringToOffsetTable.h @@ -25,8 +25,8 @@ namespace llvm { class StringToOffsetTable { StringMap<unsigned> StringOffset; std::string AggregateString; + public: - unsigned GetOrAddStringOffset(StringRef Str, bool appendZero = true) { StringMapEntry<unsigned> &Entry = StringOffset.GetOrCreateValue(Str, -1U); if (Entry.getValue() == -1U) { @@ -36,10 +36,10 @@ public: if (appendZero) AggregateString += '\0'; } - + return Entry.getValue(); } - + void EmitString(raw_ostream &O) { // Escape the string. SmallString<256> Str; @@ -55,11 +55,11 @@ public: } O << AggregateString[i]; ++CharsPrinted; - + // Print escape sequences all together. if (AggregateString[i] != '\\') continue; - + assert(i+1 < AggregateString.size() && "Incomplete escape sequence!"); if (isdigit(AggregateString[i+1])) { assert(isdigit(AggregateString[i+2]) && |