From 767b3d2000a00c56e1a3c19372810e2b7d66b76c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 22 Sep 2013 14:10:29 +0000 Subject: [PATCH] Fix array_pod_sort predicates after LLVM change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191176 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ReachableCode.cpp | 7 +++---- lib/Frontend/PrintPreprocessedOutput.cpp | 4 +--- lib/Serialization/ASTWriter.cpp | 10 ++++------ lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 6 +++--- tools/libclang/CIndex.cpp | 15 +++------------ 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp index e15fe7d126..61d521520e 100644 --- a/lib/Analysis/ReachableCode.cpp +++ b/lib/Analysis/ReachableCode.cpp @@ -110,10 +110,9 @@ const Stmt *DeadCodeScan::findDeadCode(const clang::CFGBlock *Block) { return 0; } -static int SrcCmp(const void *p1, const void *p2) { - return - ((const std::pair*) p2)->second->getLocStart() < - ((const std::pair*) p1)->second->getLocStart(); +static int SrcCmp(const std::pair *p1, + const std::pair *p2) { + return p2->second->getLocStart() < p1->second->getLocStart(); } unsigned DeadCodeScan::scanBackwards(const clang::CFGBlock *Start, diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 3e45fc79f4..ecdfb095e6 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -691,9 +691,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, } typedef std::pair id_macro_pair; -static int MacroIDCompare(const void* a, const void* b) { - const id_macro_pair *LHS = static_cast(a); - const id_macro_pair *RHS = static_cast(b); +static int MacroIDCompare(const id_macro_pair *LHS, const id_macro_pair *RHS) { return LHS->first->getName().compare(RHS->first->getName()); } diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 28a5a423fd..a4879226f9 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -1861,12 +1861,10 @@ public: }; } // end anonymous namespace -static int compareMacroDirectives(const void *XPtr, const void *YPtr) { - const std::pair &X = - *(const std::pair*)XPtr; - const std::pair &Y = - *(const std::pair*)YPtr; - return X.first->getName().compare(Y.first->getName()); +static int compareMacroDirectives( + const std::pair *X, + const std::pair *Y) { + return X->first->getName().compare(Y->first->getName()); } static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule, diff --git a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp index 051ef8ca6b..a2c8d1fd8f 100644 --- a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -156,9 +156,9 @@ namespace { class ConfigDumper : public Checker< check::EndOfTranslationUnit > { typedef AnalyzerOptions::ConfigTable Table; - static int compareEntry(const void *LHS, const void *RHS) { - return (*(const Table::MapEntryTy **)LHS)->getKey().compare( - (*(const Table::MapEntryTy **)RHS)->getKey()); + static int compareEntry(const Table::MapEntryTy *const *LHS, + const Table::MapEntryTy *const *RHS) { + return (*LHS)->getKey().compare((*RHS)->getKey()); } public: diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 0fc36b2f02..036b46dcf7 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -748,18 +748,9 @@ bool CursorVisitor::VisitDeclaratorDecl(DeclaratorDecl *DD) { } /// \brief Compare two base or member initializers based on their source order. -static int CompareCXXCtorInitializers(const void* Xp, const void *Yp) { - CXXCtorInitializer const * const *X - = static_cast(Xp); - CXXCtorInitializer const * const *Y - = static_cast(Yp); - - if ((*X)->getSourceOrder() < (*Y)->getSourceOrder()) - return -1; - else if ((*X)->getSourceOrder() > (*Y)->getSourceOrder()) - return 1; - else - return 0; +static int CompareCXXCtorInitializers(CXXCtorInitializer *const *X, + CXXCtorInitializer *const *Y) { + return (*X)->getSourceOrder() - (*Y)->getSourceOrder(); } bool CursorVisitor::VisitFunctionDecl(FunctionDecl *ND) { -- 2.40.0