forked from OSchip/llvm-project
Remove dead code, caught by unused function warnings.
llvm-svn: 111091
This commit is contained in:
parent
c99bab034c
commit
1cec2cc798
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -125,8 +125,6 @@ namespace {
|
|||
Expr *VisitCompoundAssignOperator(CompoundAssignOperator *E);
|
||||
Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
|
||||
Expr *VisitCStyleCastExpr(CStyleCastExpr *E);
|
||||
|
||||
bool ImportCasePath(CastExpr *E, CXXCastPath &Path);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -128,7 +128,6 @@ public:
|
|||
void VisitDeclStmt(DeclStmt *DS);
|
||||
private:
|
||||
void VisitVarDecl(VarDecl *VD);
|
||||
void CheckStringRefBoundtoTemporaryString(VarDecl *VD);
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
{}
|
||||
|
|
Loading…
Reference in New Issue