[llvm-commits] [llvm] r163996 -
Craig Topper
craig.topper at gmail.com
Sun Sep 16 01:11:07 PDT 2012
I was considering that. Stylistically do we want virtual and override or
just override? I borrowed code from Chromium for a plugin to detect these
cases so I can pretty easily do either.
On Sun, Sep 16, 2012 at 12:54 AM, David Blaikie <dblaikie at gmail.com> wrote:
> /llvm/trunk/include/llvm/TableGen/Record.h
> MIME-Version: 1.0
> Content-Type: text/plain; charset="utf-8"
> Content-Transfer-Encoding: 7bit
>
> Might it be more useful to add a C++11 compatibility macro
> for 'override'?
> From: Craig Topper
> Sent: 9/16/2012 12:42 AM
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm-commits] [llvm] r163996
> - /llvm/trunk/include/llvm/TableGen/Record.h
> 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
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120916/65e25899/attachment.html>
More information about the llvm-commits
mailing list