[llvm-commits] [llvm] r169536 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h

Evan Cheng evan.cheng at apple.com
Thu Dec 6 15:40:05 PST 2012


On Dec 6, 2012, at 2:39 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Thu, Dec 6, 2012 at 2:11 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>> On Dec 6, 2012, at 1:03 PM, Matt Beaumont-Gay <matthewbg at google.com> wrote:
>>> GCC's -Woverloaded-virtual complains thusly:
>>> In file included from llvm/lib/Target/ARM/ARMISelLowering.h:23:0,
>>>                from llvm/lib/Target/ARM/ARMTargetMachine.h:18,
>>>                from llvm/lib/Target/ARM/ARMFastISel.cpp:21:
>>> llvm/include/llvm/Target/TargetLowering.h:1708:16: error: 'virtual
>>> bool llvm::TargetLowering::isZExtFree(llvm::Type*, llvm::Type*) const'
>>> was hidden [-Werror=overloaded-virtual]
>>> In file included from llvm/lib/Target/ARM/ARMTargetMachine.h:18:0,
>>>                from llvm/lib/Target/ARM/ARMFastISel.cpp:21:
>>> llvm/lib/Target/ARM/ARMISelLowering.h:297:18: error:   by 'virtual
>>> bool llvm::ARMTargetLowering::isZExtFree(llvm::SDValue, llvm::EVT)
>>> const' [-Werror=overloaded-virtual]
>>> In file included from llvm/lib/Target/ARM/ARMISelLowering.h:23:0,
>>>                from llvm/lib/Target/ARM/ARMTargetMachine.h:18,
>>>                from llvm/lib/Target/ARM/ARMFastISel.cpp:21:
>>> llvm/include/llvm/Target/TargetLowering.h:1712:16: error: 'virtual
>>> bool llvm::TargetLowering::isZExtFree(llvm::EVT, llvm::EVT) const' was
>>> hidden [-Werror=overloaded-virtual]
>>> In file included from llvm/lib/Target/ARM/ARMTargetMachine.h:18:0,
>>>                from llvm/lib/Target/ARM/ARMFastISel.cpp:21:
>>> llvm/lib/Target/ARM/ARMISelLowering.h:297:18: error:   by 'virtual
>>> bool llvm::ARMTargetLowering::isZExtFree(llvm::SDValue, llvm::EVT)
>>> const' [-Werror=overloaded-virtual]
>> 
>> That seems like a bug in GCC to me. It's totally unnecessary to add the other two isZExtFree() to ARMTargetLowerting.
> 
> Clang's and GCC's warnings are checking for different things. Clang is
> looking for cases where we think you were trying to override a virtual
> function, but got the signature wrong. GCC is looking for cases where
> calling a function on the derived class object would call a different
> overload than calling a function on the base class object (because
> some of the base class overloads are hidden) -- and I'm not sure why
> it only applies this to virtual functions, FWIW.

Thanks for the explanation. I didn't know the difference in the warnings. It seems curious they are different.

Evan

> 
> GCC's warning is right here; the question is whether we actually care
> about the property which it's checking for (I think we do). The fix is
> to add 'using TargetLowering::isZExtFree;' to ARMTargetLowering.




More information about the llvm-commits mailing list