[LLVMdev] -Woverloaded-virtual

Reid Spencer rspencer at reidspencer.com
Sun Aug 27 18:11:51 PDT 2006


All,

As of today, LLVM will be built with the -Woverloaded-virtual option
turned on. This means that warnings will be generated for ambiguous
overloads of C++ sub-classes. Typically this means you forgot to
override an overloaded virtual in a subclass. Currently, LLVM is
"overloaded virtual" clean. We intend to keep it that way.  If you are
modifying LLVM and start to see warning messages like the following:

AliasAnalysis.h:241: warning: `virtual llvm::AliasAnalysis::ModRefResult llvm::AliasAnalysis::getModRefInfo(llvm::CallSite, llvm::CallSite)' was hidden
Steensgaard.cpp:68: warning:   by `virtual llvm::AliasAnalysis::ModRefResult <unnamed>::Steens::getModRefInfo(llvm::CallSite, llvm::Value*, unsigned int)'

then you need to fix it before committing. The fix usually involves:

(a) renaming the overloads so they aren't overloaded (best option)
(b) providing definitions for all overloaded virtuals in all subclasses

For further details, please see PR387.

Reid.




More information about the llvm-dev mailing list