From 3a9ec2463ddeba0820f284e2952bd6919cd5e080 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 28 Aug 2006 01:02:49 +0000 Subject: [PATCH] For PR387: Close out this long standing bug by removing the remaining overloaded virtual functions in LLVM. The -Woverloaded-virtual option is now turned on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29934 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.rules | 2 +- include/llvm/Assembly/Writer.h | 4 ++++ lib/Analysis/DataStructure/Steensgaard.cpp | 9 ++++++++- lib/Analysis/IPA/Andersens.cpp | 8 +++++++- lib/Target/PowerPC/PPCISelLowering.cpp | 4 ++++ lib/Target/PowerPC/PPCISelLowering.h | 1 + lib/VMCore/AsmWriter.cpp | 3 +-- tools/opt/GraphPrinters.cpp | 1 + 8 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 8c595c289f7..457c7f8a27c 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -254,7 +254,7 @@ else C.Flags += -D_DEBUG endif -CXX.Flags += $(CXXFLAGS) +CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual C.Flags += $(CFLAGS) CPP.BaseFlags += $(CPPFLAGS) LD.Flags += $(LDFLAGS) diff --git a/include/llvm/Assembly/Writer.h b/include/llvm/Assembly/Writer.h index c8c09e809eb..8b96d0db15a 100644 --- a/include/llvm/Assembly/Writer.h +++ b/include/llvm/Assembly/Writer.h @@ -43,6 +43,10 @@ std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true, std::ostream &WriteAsOperand(std::ostream&, const Type*, bool PrintTy = true, bool PrintName = true, const Module* Context = 0); +#ifndef NDEBUG +void dumpType(const Type* Ty); +void dumpValue(const Value* Val); +#endif } // End llvm namespace #endif diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index c7e32202cf7..eb5b74ca022 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -65,7 +65,8 @@ namespace { AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size); - ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); + virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); + virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2); private: void ResolveFunctionCall(Function *F, const DSCallSite &Call, @@ -266,3 +267,9 @@ Steens::getModRefInfo(CallSite CS, Value *P, unsigned Size) { return (ModRefResult)(Result & AliasAnalysis::getModRefInfo(CS, P, Size)); } + +AliasAnalysis::ModRefResult +Steens::getModRefInfo(CallSite CS1, CallSite CS2) +{ + return AliasAnalysis::getModRefInfo(CS1,CS2); +} diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index c9f5871b725..bb3f25427c8 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -236,7 +236,8 @@ namespace { // AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size); - ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); + virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); + virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2); void getMustAliases(Value *P, std::vector &RetVals); bool pointsToConstantMemory(const Value *P); @@ -387,6 +388,11 @@ Andersens::getModRefInfo(CallSite CS, Value *P, unsigned Size) { return AliasAnalysis::getModRefInfo(CS, P, Size); } +AliasAnalysis::ModRefResult +Andersens::getModRefInfo(CallSite CS1, CallSite CS2) { + return AliasAnalysis::getModRefInfo(CS1,CS2); +} + /// getMustAlias - We can provide must alias information if we know that a /// pointer can only point to a specific function or the null pointer. /// Unfortunately we cannot determine must-alias information for global diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 067063df259..31e209adf41 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -2691,3 +2691,7 @@ bool PPCTargetLowering::isLegalAddressImmediate(int64_t V) const { // PPC allows a sign-extended 16-bit immediate field. return (V > -(1 << 16) && V < (1 << 16)-1); } + +bool PPCTargetLowering::isLegalAddressImmediate(llvm::GlobalValue* GV) const { + return TargetLowering::isLegalAddressImmediate(GV); +} diff --git a/lib/Target/PowerPC/PPCISelLowering.h b/lib/Target/PowerPC/PPCISelLowering.h index d9defe23241..467b3f0955d 100644 --- a/lib/Target/PowerPC/PPCISelLowering.h +++ b/lib/Target/PowerPC/PPCISelLowering.h @@ -199,6 +199,7 @@ namespace llvm { /// isLegalAddressImmediate - Return true if the integer value can be used /// as the offset of the target addressing mode. virtual bool isLegalAddressImmediate(int64_t V) const; + virtual bool isLegalAddressImmediate(llvm::GlobalValue*) const; }; } diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 890b5986874..f3bcfb53ba5 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1081,8 +1081,7 @@ void AssemblyWriter::printInfoComment(const Value &V) { } } -/// printInstruction - This member is called for each Instruction in a function.. -/// +// This member is called for each Instruction in a function.. void AssemblyWriter::printInstruction(const Instruction &I) { if (AnnotationWriter) AnnotationWriter->emitInstructionAnnot(&I, Out); diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index 8ae0a0340ce..8c0ef776c2e 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -65,6 +65,7 @@ namespace { } void print(std::ostream &OS) const {} + void print(std::ostream &OS, const llvm::Module*) const {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired();