[LLVMbugs] [Bug 387] NEW: Need -Woverloaded-virtual To Catch Inheritance Errors
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Jun 24 10:57:01 PDT 2004
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=387
Summary: Need -Woverloaded-virtual To Catch Inheritance Errors
Product: Build scripts
Version: cvs
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Makefiles
AssignedTo: unassignedbugs at nondot.org
ReportedBy: rspencer at x10sys.com
CC: ghost at cs.msu.su
We need to start using the -Woverloaded-virtual option in the makefiles to catch
some inheritance bugs. Patches for this bug should first rid all of LLVM of
warnings produced by -Woverloaded-virtual option and then patch the makefiles to
turn the option on.
This idea submitted by Vladimir Prus where he made the following comments on
LLVMdev list:
I've just had some fun, because I wanted to override
FunctionPass::addAnalysisUsage, but forgot "const" after the method name --
so instead of overriding I've just created a new unrelated method.
After spending some time on this, I've decided to add -Woverloaded-virtual
option to compiler to catch such cases. However, it also gives some warnings
on LLVM code:
../../../include/llvm/Pass.h:264: warning: `virtual bool
llvm::FunctionPass::run(llvm::Module&)' was hidden
../../../include/llvm/Pass.h:326: warning: by `bool
llvm::BasicBlockPass::run(llvm::BasicBlock&)'
../../../include/llvm/Pass.h:275: warning: `virtual void
llvm::FunctionPass::addToPassManager(llvm::PassManagerT<llvm::Module>*,
llvm::AnalysisUsage&)' was hidden
../../../include/llvm/Pass.h:332: warning: by `virtual void
llvm::BasicBlockPass::addToPassManager(llvm::PassManagerT<llvm::BasicBlock>*,
llvm::AnalysisUsage&)'
The problem is that "run" method is virtual in Path (with Module& as
argument), but another version (non-virtual), which takes BasicBlock& is
defined in BasicBlockPath.
Do you think this warning is worth fixing? One possible approach is to rename
virtual run(Module&) to runOnModule, but that would require updating all
derived classes :-(
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list