]> granicus.if.org Git - clang/commitdiff
Remove dead code, caught by unused function warnings.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Aug 2010 01:15:58 +0000 (01:15 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Aug 2010 01:15:58 +0000 (01:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111091 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/CFG.h
lib/AST/ASTContext.cpp
lib/AST/ASTImporter.cpp
lib/AST/TypeLoc.cpp
lib/Basic/Diagnostic.cpp
lib/Checker/BasicObjCFoundationChecks.cpp
lib/Checker/LLVMConventionsChecker.cpp
lib/CodeGen/CGObjCMac.cpp
lib/Rewrite/RewriteObjC.cpp
lib/Sema/SemaChecking.cpp

index b3bb8ae7df94f72fbe9bed0e691f26615de78700..b7a8e1159693a6e13dea2af57e11fa2fdee0a75b 100644 (file)
@@ -35,22 +35,6 @@ namespace clang {
   class LangOptions;
   class ASTContext;
 
-namespace {
-// An element of the CFG for implicit descructor calls implied by the language
-// rules.
-class Dtor {
-  // Statement that introduces the variable.
-  Stmt *S;
-  // A token which ends the scope, return, goto, throw, }.
-  SourceLocation Loc;
-public:
-  Dtor(Stmt *s, SourceLocation l) : S(s), Loc(l) {
-  }
-  SourceLocation getLoc() { return Loc; }
-  Stmt *getStmt() { return S; }
-};
-}
-
 /// CFGElement - Represents a top-level expression in a basic block.
 class CFGElement {
   llvm::PointerIntPair<Stmt *, 2> Data;
@@ -59,7 +43,6 @@ public:
   explicit CFGElement() {}
   CFGElement(Stmt *S, bool lvalue) : Data(S, lvalue ? 1 : 0) {}
   CFGElement(Stmt *S, Type t) : Data(S, t == StartScope ? 2 : 3) {}
-  // CFGElement(Dtor *S, Type t) : Data(reinterpret_cast<Stmt*>(S), 4) {}
   Stmt *getStmt() const { return Data.getPointer(); }
   bool asLValue() const { return Data.getInt() == 1; }
   bool asStartScope() const { return Data.getInt() == 2; }
@@ -67,7 +50,6 @@ public:
   bool asDtor() const { return Data.getInt() == 4; }
   operator Stmt*() const { return getStmt(); }
   operator bool() const { return getStmt() != 0; }
-  operator Dtor*() const { return reinterpret_cast<Dtor*>(getStmt()); }
 };
 
 /// CFGBlock - Represents a single basic block in a source-level CFG.
index 3ec4ae7dc10412e4ea6cd3281a29315f1861f3f9..adb75f0f61ef927739840ae965c7f817903c8854 100644 (file)
@@ -463,20 +463,6 @@ void ASTContext::addOverriddenMethod(const CXXMethodDecl *Method,
   OverriddenMethods[Method].push_back(Overridden);
 }
 
-namespace {
-  class BeforeInTranslationUnit
-    : std::binary_function<SourceRange, SourceRange, bool> {
-    SourceManager *SourceMgr;
-
-  public:
-    explicit BeforeInTranslationUnit(SourceManager *SM) : SourceMgr(SM) { }
-
-    bool operator()(SourceRange X, SourceRange Y) {
-      return SourceMgr->isBeforeInTranslationUnit(X.getBegin(), Y.getBegin());
-    }
-  };
-}
-
 //===----------------------------------------------------------------------===//
 //                         Type Sizing and Analysis
 //===----------------------------------------------------------------------===//
index 8b67f77a8b98c5b3d2be9be2b68b1eb18ac81bbd..5feaa22be454699a01c24fa9b6d5b2de300dd66b 100644 (file)
@@ -125,8 +125,6 @@ namespace {
     Expr *VisitCompoundAssignOperator(CompoundAssignOperator *E);
     Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
     Expr *VisitCStyleCastExpr(CStyleCastExpr *E);
-
-    bool ImportCasePath(CastExpr *E, CXXCastPath &Path);
   };
 }
 
index 4893b384dd101ae67d88c79df2eea963d664b841..66578fb3dc498349e540a8e4f217b3b6104a586d 100644 (file)
@@ -74,20 +74,6 @@ TypeLoc TypeLoc::getNextTypeLocImpl(TypeLoc TL) {
   return NextLoc().Visit(TL);
 }
 
-namespace {
-  struct TypeLocInitializer : public TypeLocVisitor<TypeLocInitializer> {
-    SourceLocation Loc;
-    TypeLocInitializer(SourceLocation Loc) : Loc(Loc) {}
-  
-#define ABSTRACT_TYPELOC(CLASS, PARENT)
-#define TYPELOC(CLASS, PARENT) \
-    void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
-      TyLoc.initializeLocal(Loc); \
-    }
-#include "clang/AST/TypeLocNodes.def"
-  };
-}
-
 /// \brief Initializes a type location, and all of its children
 /// recursively, as if the entire tree had been written in the
 /// given location.
index 162de8989bc754bfa6ded8d21bbd7e0ad41a79f1..1e911ec8029d8e4e1df542fadcde0d5c133cd7b3 100644 (file)
@@ -61,9 +61,6 @@ struct StaticDiagInfoRec {
   bool operator<(const StaticDiagInfoRec &RHS) const {
     return DiagID < RHS.DiagID;
   }
-  bool operator>(const StaticDiagInfoRec &RHS) const {
-    return DiagID > RHS.DiagID;
-  }
 };
 
 }
index 1d6104ec8cda43cb9cdf22fa79c6095d8f45ff3f..3c1a6d1c8282fadf4373935d702084bc2ec2580a 100644 (file)
@@ -73,9 +73,6 @@ class BasicObjCFoundationChecks : public GRSimpleAPICheck {
   bool isNSString(const ObjCInterfaceType *T, llvm::StringRef suffix);
   bool AuditNSString(ExplodedNode* N, const ObjCMessageExpr* ME);
 
-  void Warn(ExplodedNode* N, const Expr* E, const std::string& s);
-  void WarnNilArg(ExplodedNode* N, const Expr* E);
-
   bool CheckNilArg(ExplodedNode* N, unsigned Arg);
 
 public:
index c1212572f8f4b79b2466f5f23f7eae1d7f72c4c8..2f87da142c1a84d69beacf5ea6c4be8be7e91d27 100644 (file)
@@ -128,7 +128,6 @@ public:
   void VisitDeclStmt(DeclStmt *DS);
 private:
   void VisitVarDecl(VarDecl *VD);
-  void CheckStringRefBoundtoTemporaryString(VarDecl *VD);
 };
 } // end anonymous namespace
 
index 47e303fb1eb68ff79507c6a7b36f0b73f2a06d24..c484737c4b5dab2ad8bf2f16159ab2a73d972831 100644 (file)
@@ -771,28 +771,6 @@ public:
                                       "objc_msgSendSuper2_stret_fixup");
   }
 
-
-
-  /// EHPersonalityPtr - LLVM value for an i8* to the Objective-C
-  /// exception personality function.
-  llvm::Value *getEHPersonalityPtr() {
-    llvm::Constant *Personality =
-      CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::getInt32Ty(VMContext),
-                                                        true),
-                                "__objc_personality_v0");
-    return llvm::ConstantExpr::getBitCast(Personality, Int8PtrTy);
-  }
-
-  llvm::Constant *getUnwindResumeOrRethrowFn() {
-    std::vector<const llvm::Type*> Params;
-    Params.push_back(Int8PtrTy);
-    return CGM.CreateRuntimeFunction(
-      llvm::FunctionType::get(llvm::Type::getVoidTy(VMContext),
-                              Params, false),
-      (CGM.getLangOptions().SjLjExceptions ? "_Unwind_SjLj_Resume" :
-       "_Unwind_Resume_or_Rethrow"));
-  }
-
   llvm::Constant *getObjCEndCatchFn() {
     return CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::getVoidTy(VMContext),
                                                              false),
@@ -1071,15 +1049,6 @@ private:
   /// EmitSuperClassRef - Emits reference to class's main metadata class.
   llvm::Value *EmitSuperClassRef(const ObjCInterfaceDecl *ID);
 
-  CodeGen::RValue EmitMessageSend(CodeGen::CodeGenFunction &CGF,
-                                  ReturnValueSlot Return,
-                                  QualType ResultType,
-                                  Selector Sel,
-                                  llvm::Value *Arg0,
-                                  QualType Arg0Ty,
-                                  bool IsSuper,
-                                  const CallArgList &CallArgs);
-
   /// EmitIvarList - Emit the ivar list for the given
   /// implementation. If ForClass is true the list of class ivars
   /// (i.e. metaclass ivars) is emitted, otherwise the list of
@@ -3984,11 +3953,6 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarName(IdentifierInfo *ID) {
   return GetMethodVarName(CGM.getContext().Selectors.getNullarySelector(ID));
 }
 
-// FIXME: Merge into a single cstring creation function.
-llvm::Constant *CGObjCCommonMac::GetMethodVarName(const std::string &Name) {
-  return GetMethodVarName(&CGM.getContext().Idents.get(Name));
-}
-
 llvm::Constant *CGObjCCommonMac::GetMethodVarType(const FieldDecl *Field) {
   std::string TypeStr;
   CGM.getContext().getObjCEncodingForType(Field->getType(), TypeStr, Field);
index 45c707fe29f203e508e03541a5fd1c6daa7bef43..2cbf5f308c07c28883340114a614ea2eba82cdaf 100644 (file)
@@ -229,14 +229,6 @@ namespace {
       Diags.Report(Context->getFullLoc(Loc), RewriteFailedDiag);
     }
 
-    void RemoveText(SourceLocation Loc, unsigned StrLen) {
-      // If removal succeeded or warning disabled return with no warning.
-      if (!Rewrite.RemoveText(Loc, StrLen) || SilenceRewriteMacroWarning)
-        return;
-
-      Diags.Report(Context->getFullLoc(Loc), RewriteFailedDiag);
-    }
-
     void ReplaceText(SourceLocation Start, unsigned OrigLength,
                      llvm::StringRef Str) {
       // If removal succeeded or warning disabled return with no warning.
@@ -248,9 +240,7 @@ namespace {
     }
 
     // Syntactic Rewriting.
-    void RewritePrologue(SourceLocation Loc);
     void RewriteInclude();
-    void RewriteTabs();
     void RewriteForwardClassDecl(ObjCClassDecl *Dcl);
     void RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
                                  ObjCImplementationDecl *IMD,
@@ -275,7 +265,6 @@ namespace {
     void RewriteTypeOfDecl(VarDecl *VD);
     void RewriteObjCQualifiedInterfaceTypes(Expr *E);
     bool needToScanForQualifiers(QualType T);
-    bool isSuperReceiver(Expr *recExpr);
     QualType getSuperStructType();
     QualType getConstantStringStructType();
     QualType convertFunctionTypeOfBlocks(const FunctionType *FT);
@@ -305,8 +294,6 @@ namespace {
     void RewriteSyncReturnStmts(Stmt *S, std::string buf);
     Stmt *RewriteObjCTryStmt(ObjCAtTryStmt *S);
     Stmt *RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S);
-    Stmt *RewriteObjCCatchStmt(ObjCAtCatchStmt *S);
-    Stmt *RewriteObjCFinallyStmt(ObjCAtFinallyStmt *S);
     Stmt *RewriteObjCThrowStmt(ObjCAtThrowStmt *S);
     Stmt *RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
                                        SourceLocation OrigEnd);
@@ -371,7 +358,6 @@ namespace {
     void InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD);
 
     // Block specific rewrite rules.
-    void RewriteBlockCall(CallExpr *Exp);
     void RewriteBlockPointerDecl(NamedDecl *VD);
     void RewriteByRefVar(VarDecl *VD);
     std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag);
@@ -747,36 +733,6 @@ void RewriteObjC::RewriteInclude() {
   }
 }
 
-void RewriteObjC::RewriteTabs() {
-  llvm::StringRef MainBuf = SM->getBufferData(MainFileID);
-  const char *MainBufStart = MainBuf.begin();
-  const char *MainBufEnd = MainBuf.end();
-
-  // Loop over the whole file, looking for tabs.
-  for (const char *BufPtr = MainBufStart; BufPtr != MainBufEnd; ++BufPtr) {
-    if (*BufPtr != '\t')
-      continue;
-
-    // Okay, we found a tab.  This tab will turn into at least one character,
-    // but it depends on which 'virtual column' it is in.  Compute that now.
-    unsigned VCol = 0;
-    while (BufPtr-VCol != MainBufStart && BufPtr[-VCol-1] != '\t' &&
-           BufPtr[-VCol-1] != '\n' && BufPtr[-VCol-1] != '\r')
-      ++VCol;
-
-    // Okay, now that we know the virtual column, we know how many spaces to
-    // insert.  We assume 8-character tab-stops.
-    unsigned Spaces = 8-(VCol & 7);
-
-    // Get the location of the tab.
-    SourceLocation TabLoc = SM->getLocForStartOfFile(MainFileID);
-    TabLoc = TabLoc.getFileLocWithOffset(BufPtr-MainBufStart);
-
-    // Rewrite the single tab character into a sequence of spaces.
-    ReplaceText(TabLoc, 1, llvm::StringRef("        ", Spaces));
-  }
-}
-
 static std::string getIvarAccessString(ObjCInterfaceDecl *ClassDecl,
                                        ObjCIvarDecl *OID) {
   std::string S;
@@ -2024,14 +1980,6 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
   return 0;
 }
 
-Stmt *RewriteObjC::RewriteObjCCatchStmt(ObjCAtCatchStmt *S) {
-  return 0;
-}
-
-Stmt *RewriteObjC::RewriteObjCFinallyStmt(ObjCAtFinallyStmt *S) {
-  return 0;
-}
-
 // This can't be done with ReplaceStmt(S, ThrowExpr), since
 // the throw expression is typically a message expression that's already
 // been rewritten! (which implies the SourceLocation's are invalid).
@@ -2636,12 +2584,6 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
   return cast;
 }
 
-bool RewriteObjC::isSuperReceiver(Expr *recExpr) {
-  // check if we are sending a message to 'super'
-  if (!CurMethodDef || !CurMethodDef->isInstanceMethod()) return false;
-  return isa<ObjCSuperExpr>(recExpr);
-}
-
 // struct objc_super { struct objc_object *receiver; struct objc_class *super; };
 QualType RewriteObjC::getSuperStructType() {
   if (!SuperStructDecl) {
@@ -4696,11 +4638,6 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
   return CE;
 }
 
-void RewriteObjC::RewriteBlockCall(CallExpr *Exp) {
-  Stmt *BlockCall = SynthesizeBlockCall(Exp, Exp->getCallee());
-  ReplaceStmt(Exp, BlockCall);
-}
-
 // We need to return the rewritten expression to handle cases where the
 // BlockDeclRefExpr is embedded in another expression being rewritten.
 // For example:
index f6d37d432d79fad8a9ea5a37d0fe22d244b8c362..3245d0c987e5f9258390faa7090b5789ac710934 100644 (file)
@@ -2102,7 +2102,6 @@ struct IntRange {
   /// True if the int is known not to have negative values.
   bool NonNegative;
 
-  IntRange() {}
   IntRange(unsigned Width, bool NonNegative)
     : Width(Width), NonNegative(NonNegative)
   {}