From 6490ae5003226cae28f980648948bea8b21a8638 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 17 Nov 2009 06:14:37 +0000 Subject: [PATCH] Silence some warnings produced by Clang, and add a missing header git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89051 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../clang/Analysis/PathSensitive/AnalysisContext.h | 1 + lib/Frontend/AnalysisConsumer.cpp | 14 +++++++------- lib/Index/ResolveLocation.cpp | 2 +- lib/Sema/JumpDiagnostics.cpp | 2 +- lib/Sema/ParseAST.cpp | 2 +- lib/Sema/SemaDeclCXX.cpp | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/clang/Analysis/PathSensitive/AnalysisContext.h b/include/clang/Analysis/PathSensitive/AnalysisContext.h index 66e850a914..9b58f745f0 100644 --- a/include/clang/Analysis/PathSensitive/AnalysisContext.h +++ b/include/clang/Analysis/PathSensitive/AnalysisContext.h @@ -15,6 +15,7 @@ #ifndef LLVM_CLANG_ANALYSIS_ANALYSISCONTEXT_H #define LLVM_CLANG_ANALYSIS_ANALYSISCONTEXT_H +#include "clang/AST/Stmt.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/DenseMap.h" diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index b0799af3bf..ede3d474c8 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -44,11 +44,6 @@ static ExplodedNode::Auditor* CreateUbiViz(); // Basic type definitions. //===----------------------------------------------------------------------===// -namespace { - class AnalysisConsumer; - typedef void (*CodeAction)(AnalysisConsumer &C, AnalysisManager &M, Decl *D); -} // end anonymous namespace - //===----------------------------------------------------------------------===// // Special PathDiagnosticClients. //===----------------------------------------------------------------------===// @@ -68,6 +63,10 @@ CreatePlistHTMLDiagnosticClient(const std::string& prefix, namespace { class VISIBILITY_HIDDEN AnalysisConsumer : public ASTConsumer { + public: + typedef void (*CodeAction)(AnalysisConsumer &C, AnalysisManager &M, Decl *D); + + private: typedef std::vector Actions; Actions FunctionActions; Actions ObjCMethodActions; @@ -189,8 +188,9 @@ public: } // end anonymous namespace namespace llvm { - template <> struct FoldingSetTrait { - static inline void Profile(CodeAction X, FoldingSetNodeID& ID) { + template <> struct FoldingSetTrait { + static inline void Profile(AnalysisConsumer::CodeAction X, + FoldingSetNodeID& ID) { ID.AddPointer(reinterpret_cast(reinterpret_cast(X))); } }; diff --git a/lib/Index/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp index 73b584b520..35a44ca166 100644 --- a/lib/Index/ResolveLocation.cpp +++ b/lib/Index/ResolveLocation.cpp @@ -484,7 +484,7 @@ ASTLocation LocResolverBase::ResolveInDeclarator(Decl *D, Stmt *Stm, assert(ContainsLocation(DInfo) && "Should visit only after verifying that loc is in range"); - TypeLocResolver(Ctx, Loc, D); + (void)TypeLocResolver(Ctx, Loc, D); for (TypeLoc TL = DInfo->getTypeLoc(); TL; TL = TL.getNextTypeLoc()) if (ContainsLocation(TL)) return TypeLocResolver(Ctx, Loc, D).Visit(TL); diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp index a8e31d2cfa..2b37e9df2c 100644 --- a/lib/Sema/JumpDiagnostics.cpp +++ b/lib/Sema/JumpDiagnostics.cpp @@ -325,5 +325,5 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, } void Sema::DiagnoseInvalidJumps(Stmt *Body) { - JumpScopeChecker(Body, *this); + (void)JumpScopeChecker(Body, *this); } diff --git a/lib/Sema/ParseAST.cpp b/lib/Sema/ParseAST.cpp index 18ab092102..dc0daae4dc 100644 --- a/lib/Sema/ParseAST.cpp +++ b/lib/Sema/ParseAST.cpp @@ -72,7 +72,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer, Consumer->HandleTopLevelDecl(ADecl.getAsVal()); }; // Check for any pending objective-c implementation decl. - while (ADecl = P.RetreivePendingObjCImpDecl()) + while ((ADecl = P.RetreivePendingObjCImpDecl())) Consumer->HandleTopLevelDecl(ADecl.getAsVal()); // process any TopLevelDecls generated by #pragma weak diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 698d81e30f..4f04bd2604 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1936,7 +1936,7 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc, } if (RD->isAbstract()) - AbstractClassUsageDiagnoser(*this, RD); + (void)AbstractClassUsageDiagnoser(*this, RD); if (!RD->isDependentType() && !RD->isInvalidDecl()) AddImplicitlyDeclaredMembersToClass(RD);