[llvm-commits] [llvm] r163996 - /llvm/trunk/include/llvm/TableGen/Record.h
Sean Silva
silvas at purdue.edu
Sun Sep 16 12:59:17 PDT 2012
Maybe we should add LLVM_OVERRIDE to our C++11-prep arsenal? This
really isn't what the `virtual` keyword is meant for...
--Sean Silva
On Sun, Sep 16, 2012 at 3:39 AM, Craig Topper <craig.topper at gmail.com> wrote:
> Author: ctopper
> Date: Sun Sep 16 02:39:55 2012
> New Revision: 163996
>
> URL: http://llvm.org/viewvc/llvm-project?rev=163996&view=rev
> Log:
> Add explicit virtual keywords for methods that override base class.
>
> 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=163996&r1=163995&r2=163996&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/TableGen/Record.h (original)
> +++ llvm/trunk/include/llvm/TableGen/Record.h Sun Sep 16 02:39:55 2012
> @@ -152,9 +152,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const { return "bit"; }
> + virtual std::string getAsString() const { return "bit"; }
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
> virtual bool baseClassOf(const BitRecTy *RHS) const { return true; }
> @@ -195,9 +195,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const;
> + virtual std::string getAsString() const;
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
> virtual bool baseClassOf(const BitRecTy *RHS) const { return Size == 1; }
> @@ -237,9 +237,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const { return "int"; }
> + virtual std::string getAsString() const { return "int"; }
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
>
> @@ -278,9 +278,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const { return "string"; }
> + virtual std::string getAsString() const { return "string"; }
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
>
> @@ -322,9 +322,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const;
> + virtual std::string getAsString() const;
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
>
> @@ -363,9 +363,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const { return "dag"; }
> + virtual std::string getAsString() const { return "dag"; }
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
>
> @@ -407,9 +407,9 @@
> virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
> virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
>
> - std::string getAsString() const;
> + virtual std::string getAsString() const;
>
> - bool typeIsConvertibleTo(const RecTy *RHS) const {
> + virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
> return RHS->baseClassOf(this);
> }
> virtual bool baseClassOf(const BitRecTy *RHS) const { return false; }
> @@ -758,7 +758,8 @@
>
> Record *getElementAsRecord(unsigned i) const;
>
> - Init *convertInitListSlice(const std::vector<unsigned> &Elements) const;
> + virtual Init *
> + convertInitListSlice(const std::vector<unsigned> &Elements) const;
>
> virtual Init *convertInitializerTo(RecTy *Ty) const {
> return Ty->convertValue(const_cast<ListInit *>(this));
> @@ -849,8 +850,8 @@
> return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
> }
>
> - int getNumOperands() const { return 1; }
> - Init *getOperand(int i) const {
> + virtual int getNumOperands() const { return 1; }
> + virtual Init *getOperand(int i) const {
> assert(i == 0 && "Invalid operand id for unary operator");
> return getOperand();
> }
> @@ -860,7 +861,7 @@
>
> // Fold - If possible, fold this to a simpler init. Return this if not
> // possible to fold.
> - Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
> + virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
>
> virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
>
> @@ -893,8 +894,8 @@
> return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
> }
>
> - int getNumOperands() const { return 2; }
> - Init *getOperand(int i) const {
> + virtual int getNumOperands() const { return 2; }
> + virtual Init *getOperand(int i) const {
> assert((i == 0 || i == 1) && "Invalid operand id for binary operator");
> if (i == 0) {
> return getLHS();
> @@ -909,7 +910,7 @@
>
> // Fold - If possible, fold this to a simpler init. Return this if not
> // possible to fold.
> - Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
> + virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
>
> virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
>
> @@ -945,8 +946,8 @@
> getType());
> }
>
> - int getNumOperands() const { return 3; }
> - Init *getOperand(int i) const {
> + virtual int getNumOperands() const { return 3; }
> + virtual Init *getOperand(int i) const {
> assert((i == 0 || i == 1 || i == 2) &&
> "Invalid operand id for ternary operator");
> if (i == 0) {
> @@ -965,7 +966,7 @@
>
> // Fold - If possible, fold this to a simpler init. Return this if not
> // possible to fold.
> - Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
> + virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
>
> virtual bool isComplete() const { return false; }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list