From 10dc8aa581f6fa804320296414a737105a4c9275 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 11 May 2010 06:18:17 +0000 Subject: [PATCH] Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe! llvm-svn: 103458 --- clang/include/clang/AST/DeclContextInternals.h | 3 ++- clang/include/clang/Analysis/ProgramPoint.h | 2 +- clang/include/clang/Parse/Ownership.h | 15 +++++++++++++++ clang/lib/AST/DeclBase.cpp | 4 ++-- clang/lib/Checker/GRExprEngine.cpp | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/DeclContextInternals.h b/clang/include/clang/AST/DeclContextInternals.h index 2a4b12ac2eaf..9602b677fca5 100644 --- a/clang/include/clang/AST/DeclContextInternals.h +++ b/clang/include/clang/AST/DeclContextInternals.h @@ -156,7 +156,8 @@ public: /// represents. DeclContext::lookup_result getLookupResult(ASTContext &Context) { if (isNull()) - return DeclContext::lookup_result(0, 0); + return DeclContext::lookup_result(DeclContext::lookup_iterator(0), + DeclContext::lookup_iterator(0)); if (hasDeclarationIDs()) materializeDecls(Context); diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h index fb8d4d5ff53a..075838d45e5c 100644 --- a/clang/include/clang/Analysis/ProgramPoint.h +++ b/clang/include/clang/Analysis/ProgramPoint.h @@ -59,7 +59,7 @@ private: protected: ProgramPoint(const void* P, Kind k, const LocationContext *l, const void *tag = 0) - : Data(P, NULL), K(k), L(l), Tag(tag) {} + : Data(P, static_cast(NULL)), K(k), L(l), Tag(tag) {} ProgramPoint(const void* P1, const void* P2, Kind k, const LocationContext *l, const void *tag = 0) diff --git a/clang/include/clang/Parse/Ownership.h b/clang/include/clang/Parse/Ownership.h index dfbb301f3b21..e9a20b7872b5 100644 --- a/clang/include/clang/Parse/Ownership.h +++ b/clang/include/clang/Parse/Ownership.h @@ -403,8 +403,10 @@ namespace clang { friend class moving::ASTResultMover; +#if !(defined(_MSC_VER) && _MSC_VER >= 1600) ASTOwningResult(ASTOwningResult&); // DO NOT IMPLEMENT ASTOwningResult& operator =(ASTOwningResult&); // DO NOT IMPLEMENT +#endif void destroy() { if (Ptr) { @@ -444,6 +446,19 @@ namespace clang { return *this; } +#if defined(_MSC_VER) && _MSC_VER >= 1600 + // Emulated move semantics don't work with msvc. + ASTOwningResult(ASTOwningResult &&mover) + : ActionInv(mover.ActionInv), + Ptr(mover.Ptr) { + mover.Ptr = 0; + } + ASTOwningResult &operator=(ASTOwningResult &&mover) { + *this = moving::ASTResultMover(mover); + return *this; + } +#endif + /// Assignment from a raw pointer. Takes ownership - beware! ASTOwningResult &operator=(void *raw) { destroy(); diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index b5aec0c5125c..42a372632099 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -811,12 +811,12 @@ DeclContext::lookup(DeclarationName Name) { buildLookup(this); if (!LookupPtr) - return lookup_result(0, 0); + return lookup_result(lookup_iterator(0), lookup_iterator(0)); } StoredDeclsMap::iterator Pos = LookupPtr->find(Name); if (Pos == LookupPtr->end()) - return lookup_result(0, 0); + return lookup_result(lookup_iterator(0), lookup_iterator(0)); return Pos->second.getLookupResult(getParentASTContext()); } diff --git a/clang/lib/Checker/GRExprEngine.cpp b/clang/lib/Checker/GRExprEngine.cpp index b7b48d70de75..13b2c2045877 100644 --- a/clang/lib/Checker/GRExprEngine.cpp +++ b/clang/lib/Checker/GRExprEngine.cpp @@ -1970,7 +1970,7 @@ void GRExprEngine::VisitCall(CallExpr* CE, ExplodedNode* Pred, //===----------------------------------------------------------------------===// static std::pair EagerlyAssumeTag - = std::pair(&EagerlyAssumeTag,0); + = std::pair(&EagerlyAssumeTag,static_cast(0)); void GRExprEngine::EvalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src, Expr *Ex) {