[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h MachineConstantPool.h MachineInstrBuilder.h MachineJumpTableInfo.h MachineLocation.h SelectionDAGISel.h SelectionDAGNodes.h
Chris Lattner
clattner at apple.com
Fri Mar 23 14:05:25 PDT 2007
On Mar 23, 2007, at 11:44 AM, Dan Gohman wrote:
> Add the 'explicit' keyword to several constructors that accept one
> argument that don't appear intended as implicit-conversion operators.
Nice. How did you find these? Did you just inspect the code, or do
you have a tool that finds them?
-Chris
>
> ---
> Diffs of the changes: (+16 -13)
>
> MachineBasicBlock.h | 7 ++++---
> MachineConstantPool.h | 2 +-
> MachineInstrBuilder.h | 2 +-
> MachineJumpTableInfo.h | 3 ++-
> MachineLocation.h | 2 +-
> SelectionDAGISel.h | 3 ++-
> SelectionDAGNodes.h | 10 +++++-----
> 7 files changed, 16 insertions(+), 13 deletions(-)
>
>
> Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
> diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.61 llvm/
> include/llvm/CodeGen/MachineBasicBlock.h:1.62
> --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.61 Wed Feb 28
> 20:00:40 2007
> +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Fri Mar 23
> 13:44:11 2007
> @@ -79,9 +79,10 @@
> bool IsLandingPad;
>
> public:
> - MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0),
> BB(bb),
> - Number(-1), Parent
> (0),
> - IsLandingPad(false) {
> + explicit MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0),
> Next(0),
> + BB(bb),
> Number(-1),
> + Parent(0),
> +
> IsLandingPad(false) {
> Insts.parent = this;
> }
>
>
>
> Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
> diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25 llvm/
> include/llvm/CodeGen/MachineConstantPool.h:1.26
> --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25 Sat Dec 16
> 23:15:12 2006
> +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Fri Mar 23
> 13:44:11 2007
> @@ -35,7 +35,7 @@
> const Type *Ty;
>
> public:
> - MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
> + explicit MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
> virtual ~MachineConstantPoolValue() {};
>
> /// getType - get type of this MachineConstantPoolValue.
>
>
> Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
> diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.43 llvm/
> include/llvm/CodeGen/MachineInstrBuilder.h:1.44
> --- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.43 Wed Feb 14
> 20:52:40 2007
> +++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Fri Mar 23
> 13:44:11 2007
> @@ -27,7 +27,7 @@
> class MachineInstrBuilder {
> MachineInstr *MI;
> public:
> - MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
> + explicit MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
>
> /// Allow automatic conversion to the machine instruction we are
> working on.
> ///
>
>
> Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h
> diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11 llvm/
> include/llvm/CodeGen/MachineJumpTableInfo.h:1.12
> --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11 Sat Dec
> 16 23:15:12 2006
> +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Fri Mar 23
> 13:44:11 2007
> @@ -34,7 +34,8 @@
> /// MBBs - The vector of basic blocks from which to create the
> jump table.
> std::vector<MachineBasicBlock*> MBBs;
>
> - MachineJumpTableEntry(const std::vector<MachineBasicBlock*>
> &M) : MBBs(M) {}
> + explicit MachineJumpTableEntry(const
> std::vector<MachineBasicBlock*> &M)
> + : MBBs(M) {}
> };
>
> class MachineJumpTableInfo {
>
>
> Index: llvm/include/llvm/CodeGen/MachineLocation.h
> diff -u llvm/include/llvm/CodeGen/MachineLocation.h:1.3 llvm/
> include/llvm/CodeGen/MachineLocation.h:1.4
> --- llvm/include/llvm/CodeGen/MachineLocation.h:1.3 Wed Jan 24
> 12:45:12 2007
> +++ llvm/include/llvm/CodeGen/MachineLocation.h Fri Mar 23 13:44:11
> 2007
> @@ -40,7 +40,7 @@
> , Register(0)
> , Offset(0)
> {}
> - MachineLocation(unsigned R)
> + explicit MachineLocation(unsigned R)
> : IsRegister(true)
> , Register(R)
> , Offset(0)
>
>
> Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
> diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.33 llvm/
> include/llvm/CodeGen/SelectionDAGISel.h:1.34
> --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.33 Wed Mar 7
> 10:25:08 2007
> +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Fri Mar 23
> 13:44:11 2007
> @@ -42,7 +42,8 @@
> std::vector<SDNode*> TopOrder;
> unsigned DAGSize;
>
> - SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0), JT
> (0,0,0,0) {}
> + explicit SelectionDAGISel(TargetLowering &tli)
> + : TLI(tli), DAGSize(0), JT(0,0,0,0) {}
>
> TargetLowering &getTargetLowering() { return TLI; }
>
>
>
> Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
> diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.181 llvm/
> include/llvm/CodeGen/SelectionDAGNodes.h:1.182
> --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.181 Wed Mar 7
> 10:25:08 2007
> +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Mar 23
> 13:44:11 2007
> @@ -1075,7 +1075,7 @@
> virtual void ANCHOR(); // Out-of-line virtual method to give
> class a home.
> SDOperand Op;
> public:
> - HandleSDNode(SDOperand X)
> + explicit HandleSDNode(SDOperand X)
> : SDNode(ISD::HANDLENODE, getSDVTList(MVT::Other)), Op(X) {
> InitOperands(&Op, 1);
> }
> @@ -1088,7 +1088,7 @@
> virtual void ANCHOR(); // Out-of-line virtual method to give
> class a home.
> protected:
> friend class SelectionDAG;
> - StringSDNode(const std::string &val)
> + explicit StringSDNode(const std::string &val)
> : SDNode(ISD::STRING, getSDVTList(MVT::Other)), Value(val) {
> }
> public:
> @@ -1298,7 +1298,7 @@
> virtual void ANCHOR(); // Out-of-line virtual method to give
> class a home.
> protected:
> friend class SelectionDAG;
> - BasicBlockSDNode(MachineBasicBlock *mbb)
> + explicit BasicBlockSDNode(MachineBasicBlock *mbb)
> : SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) {
> }
> public:
> @@ -1375,7 +1375,7 @@
> virtual void ANCHOR(); // Out-of-line virtual method to give
> class a home.
> protected:
> friend class SelectionDAG;
> - CondCodeSDNode(ISD::CondCode Cond)
> + explicit CondCodeSDNode(ISD::CondCode Cond)
> : SDNode(ISD::CONDCODE, getSDVTList(MVT::Other)), Condition
> (Cond) {
> }
> public:
> @@ -1395,7 +1395,7 @@
> virtual void ANCHOR(); // Out-of-line virtual method to give
> class a home.
> protected:
> friend class SelectionDAG;
> - VTSDNode(MVT::ValueType VT)
> + explicit VTSDNode(MVT::ValueType VT)
> : SDNode(ISD::VALUETYPE, getSDVTList(MVT::Other)), ValueType
> (VT) {
> }
> public:
>
>
>
> _______________________________________________
> 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