From 06159e878569e5f39bf0e8f11b84ac3ad0970597 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 15 Dec 2009 07:26:51 +0000 Subject: [PATCH] update to match LLVM API change: Remove isPod() from DenseMapInfo, splitting it out to its own isPodLike type trait. This is a generally useful type trait for more than just DenseMap, and we really care about whether something acts like a pod, not whether it really is a pod. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91422 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclarationName.h | 5 +++-- include/clang/AST/TypeOrdering.h | 11 ++++------- include/clang/Analysis/ProgramPoint.h | 7 ++++--- include/clang/Basic/IdentifierTable.h | 6 ++++-- include/clang/Basic/SourceLocation.h | 8 ++++++-- include/clang/Frontend/PCHWriter.h | 1 - include/clang/Index/Entity.h | 5 +++-- include/clang/Index/GlobalSelector.h | 5 +++-- lib/Analysis/CFRefCount.cpp | 6 ++---- lib/CodeGen/GlobalDecl.h | 15 +++++++-------- lib/Sema/SemaCodeComplete.cpp | 7 ------- 11 files changed, 36 insertions(+), 40 deletions(-) diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h index 676bd2ca73..fcb4ae52e7 100644 --- a/include/clang/AST/DeclarationName.h +++ b/include/clang/AST/DeclarationName.h @@ -387,10 +387,11 @@ struct DenseMapInfo { isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS) { return LHS == RHS; } - - static inline bool isPod() { return true; } }; +template <> +struct isPodLike { static const bool value = true; }; + } // end namespace llvm #endif diff --git a/include/clang/AST/TypeOrdering.h b/include/clang/AST/TypeOrdering.h index 652f4f70bd..d97e5b04a2 100644 --- a/include/clang/AST/TypeOrdering.h +++ b/include/clang/AST/TypeOrdering.h @@ -50,14 +50,11 @@ namespace llvm { static bool isEqual(clang::QualType LHS, clang::QualType RHS) { return LHS == RHS; } - - static bool isPod() { - // QualType isn't *technically* a POD type. However, we can get - // away with calling it a POD type since its copy constructor, - // copy assignment operator, and destructor are all trivial. - return true; - } }; + + // FIXME: Move to Type.h + template <> + struct isPodLike { static const bool value = true; }; } #endif diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index 78827dfabe..5abe1abd5d 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -333,10 +333,11 @@ static bool isEqual(const clang::ProgramPoint& L, return L == R; } -static bool isPod() { - return true; -} }; + +template <> +struct isPodLike { static const bool value = true; }; + } // end namespace llvm #endif diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 53939500e7..75a7b8192c 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -532,9 +532,11 @@ struct DenseMapInfo { static bool isEqual(clang::Selector LHS, clang::Selector RHS) { return LHS == RHS; } - - static bool isPod() { return true; } }; + +template <> +struct isPodLike { static const bool value = true; }; + // Provide PointerLikeTypeTraits for IdentifierInfo pointers, which // are not guaranteed to be 8-byte aligned. diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 28cf2db9bc..36baf5feec 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -21,6 +21,7 @@ namespace llvm { class MemoryBuffer; class raw_ostream; template struct DenseMapInfo; + template struct isPodLike; } namespace clang { @@ -296,9 +297,12 @@ namespace llvm { static bool isEqual(clang::FileID LHS, clang::FileID RHS) { return LHS == RHS; } - - static bool isPod() { return true; } }; + + template <> + struct isPodLike { static const bool value = true; }; + template <> + struct isPodLike { static const bool value = true; }; } // end namespace llvm diff --git a/include/clang/Frontend/PCHWriter.h b/include/clang/Frontend/PCHWriter.h index a4bc3ff5b0..212130e2ea 100644 --- a/include/clang/Frontend/PCHWriter.h +++ b/include/clang/Frontend/PCHWriter.h @@ -44,7 +44,6 @@ class TargetInfo; /// DenseMap. This uses the standard pointer hash function. struct UnsafeQualTypeDenseMapInfo { static inline bool isEqual(QualType A, QualType B) { return A == B; } - static inline bool isPod() { return true; } static inline QualType getEmptyKey() { return QualType::getFromOpaquePtr((void*) 1); } diff --git a/include/clang/Index/Entity.h b/include/clang/Index/Entity.h index 4533a1a0ac..c2aab62e23 100644 --- a/include/clang/Index/Entity.h +++ b/include/clang/Index/Entity.h @@ -134,9 +134,10 @@ struct DenseMapInfo { isEqual(clang::idx::Entity LHS, clang::idx::Entity RHS) { return LHS == RHS; } - - static inline bool isPod() { return true; } }; + +template <> +struct isPodLike { static const bool value = true; }; } // end namespace llvm diff --git a/include/clang/Index/GlobalSelector.h b/include/clang/Index/GlobalSelector.h index 51f98267f3..9cd83a8595 100644 --- a/include/clang/Index/GlobalSelector.h +++ b/include/clang/Index/GlobalSelector.h @@ -90,9 +90,10 @@ struct DenseMapInfo { isEqual(clang::idx::GlobalSelector LHS, clang::idx::GlobalSelector RHS) { return LHS == RHS; } - - static inline bool isPod() { return true; } }; + +template <> +struct isPodLike { static const bool value = true;}; } // end namespace llvm diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 1df4f7cb51..9639ad98fa 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -675,11 +675,9 @@ template <> struct DenseMapInfo { RHS.getSelector()); } - static bool isPod() { - return DenseMapInfo::isPod() && - DenseMapInfo::isPod(); - } }; +template <> +struct isPodLike { static const bool value = true; }; } // end llvm namespace namespace { diff --git a/lib/CodeGen/GlobalDecl.h b/lib/CodeGen/GlobalDecl.h index b812020f2a..b054312a01 100644 --- a/lib/CodeGen/GlobalDecl.h +++ b/lib/CodeGen/GlobalDecl.h @@ -96,15 +96,14 @@ namespace llvm { return LHS == RHS; } - static bool isPod() { - // GlobalDecl isn't *technically* a POD type. However, we can get - // away with calling it a POD type since its copy constructor, - // copy assignment operator, and destructor are all trivial. - return true; - } - }; -} + // GlobalDecl isn't *technically* a POD type. However, its copy constructor, + // copy assignment operator, and destructor are all trivial. + template <> + struct isPodLike { + static const bool value = true; + }; +} // end namespace llvm #endif diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 42ac6f19b0..4ce9330fc1 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -240,13 +240,6 @@ public: } }; -namespace llvm { - template<> - struct DenseMapInfo { - static bool isPod() { return false; } - }; -} - ResultBuilder::ShadowMapEntry::iterator ResultBuilder::ShadowMapEntry::begin() const { if (DeclOrVector.isNull()) -- 2.40.0