From 3c05b7c161d8b7a8928f0d1a193d988f027271e9 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 2 Aug 2011 04:50:49 +0000 Subject: [PATCH] Make helper functions static. llvm-svn: 136679 --- clang/lib/ARCMigrate/ARCMT.cpp | 9 +++++---- clang/lib/Analysis/LiveVariables.cpp | 5 +++-- clang/lib/Sema/SemaDeclAttr.cpp | 11 +++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index 3b44702fa1d7..c8052e3d79e1 100644 --- a/clang/lib/ARCMigrate/ARCMT.cpp +++ b/clang/lib/ARCMigrate/ARCMT.cpp @@ -176,7 +176,8 @@ static bool HasARCRuntime(CompilerInvocation &origCI) { return false; } -CompilerInvocation *createInvocationForMigration(CompilerInvocation &origCI) { +static CompilerInvocation * +createInvocationForMigration(CompilerInvocation &origCI) { llvm::OwningPtr CInvok; CInvok.reset(new CompilerInvocation(origCI)); CInvok->getPreprocessorOpts().ImplicitPCHInclude = std::string(); @@ -193,9 +194,9 @@ CompilerInvocation *createInvocationForMigration(CompilerInvocation &origCI) { return CInvok.take(); } -void emitPremigrationErrors(const CapturedDiagList &arcDiags, - const DiagnosticOptions &diagOpts, - Preprocessor &PP) { +static void emitPremigrationErrors(const CapturedDiagList &arcDiags, + const DiagnosticOptions &diagOpts, + Preprocessor &PP) { TextDiagnosticPrinter printer(llvm::errs(), diagOpts); llvm::IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); llvm::IntrusiveRefCntPtr Diags( diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp index f81019e2c9f0..c6c091e12959 100644 --- a/clang/lib/Analysis/LiveVariables.cpp +++ b/clang/lib/Analysis/LiveVariables.cpp @@ -433,10 +433,11 @@ LiveVariables::computeLiveness(AnalysisContext &AC, return new LiveVariables(LV); } -bool compare_entries(const CFGBlock *A, const CFGBlock *B) { +static bool compare_entries(const CFGBlock *A, const CFGBlock *B) { return A->getBlockID() < B->getBlockID(); } -bool compare_vd_entries(const Decl *A, const Decl *B) { + +static bool compare_vd_entries(const Decl *A, const Decl *B) { SourceLocation ALoc = A->getLocStart(); SourceLocation BLoc = B->getLocStart(); return ALoc.getRawEncoding() < BLoc.getRawEncoding(); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 0f02ed31df21..9fbd73f4b63b 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -237,10 +237,10 @@ static bool checkAttributeNumArgsPlusParams(Sema &S, const AttributeList &Attr, /// \brief Check if passed in Decl is a field or potentially shared global var /// \return true if the Decl is a field or potentially shared global variable /// -static bool mayBeSharedVariable(Decl *D) { +static bool mayBeSharedVariable(const Decl *D) { if (isa(D)) return true; - if(VarDecl *vd = dyn_cast(D)) + if (const VarDecl *vd = dyn_cast(D)) return (vd->hasGlobalStorage() && !(vd->isThreadSpecified())); return false; @@ -251,12 +251,11 @@ static bool mayBeSharedVariable(Decl *D) { /// Note that this function may produce an error message. /// \return true if the Decl is a pointer type; false otherwise /// -bool checkIsPointer(Sema & S, Decl * D, const AttributeList & Attr) { - if(ValueDecl * vd = dyn_cast (D)) { +static bool checkIsPointer(Sema &S, const Decl *D, const AttributeList &Attr) { + if (const ValueDecl *vd = dyn_cast(D)) { QualType QT = vd->getType(); - if(QT->isAnyPointerType()) { + if (QT->isAnyPointerType()) return true; - } S.Diag(Attr.getLoc(), diag::warn_pointer_attribute_wrong_type) << Attr.getName()->getName() << QT; } else {