From e81fdb1fdde48d3fa18df56c5797f6b0bc5dfc4a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 27 Mar 2013 19:38:14 +0000 Subject: [PATCH] Cleanup clang's specializations of simplify_type. Now that the basic implementation in llvm has been fixed, simplify the specializations in clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178173 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/CanonicalType.h | 7 ++----- include/clang/AST/DeclCXX.h | 11 ----------- include/clang/AST/Type.h | 6 ++---- include/clang/Analysis/CFG.h | 11 ++--------- .../StaticAnalyzer/Core/PathSensitive/CallEvent.h | 2 +- 5 files changed, 7 insertions(+), 30 deletions(-) diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h index b1b92b0f84..75f2a3b467 100644 --- a/include/clang/AST/CanonicalType.h +++ b/include/clang/AST/CanonicalType.h @@ -351,15 +351,12 @@ namespace llvm { /// CanQual to a specific Type class. We're prefer isa/dyn_cast/cast/etc. /// to return smart pointer (proxies?). template -struct simplify_type > { +struct simplify_type< ::clang::CanQual > { typedef const T *SimpleType; - static SimpleType getSimplifiedValue(const ::clang::CanQual &Val) { + static SimpleType getSimplifiedValue(::clang::CanQual &Val) { return Val.getTypePtr(); } }; -template -struct simplify_type< ::clang::CanQual > -: public simplify_type > {}; // Teach SmallPtrSet that CanQual is "basically a pointer". template diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 70d8c33608..0d24b0822a 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -69,17 +69,6 @@ public: } // end namespace clang namespace llvm { - /// Implement simplify_type for AnyFunctionDecl, so that we can dyn_cast from - /// AnyFunctionDecl to any function or function template declaration. - template<> struct simplify_type { - typedef ::clang::NamedDecl* SimpleType; - static SimpleType getSimplifiedValue(const ::clang::AnyFunctionDecl &Val) { - return Val; - } - }; - template<> struct simplify_type< ::clang::AnyFunctionDecl> - : public simplify_type {}; - // Provide PointerLikeTypeTraits for non-cvr pointers. template<> class PointerLikeTypeTraits< ::clang::AnyFunctionDecl> { diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index a700720b2f..900912d75d 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -998,14 +998,12 @@ private: namespace llvm { /// Implement simplify_type for QualType, so that we can dyn_cast from QualType /// to a specific Type class. -template<> struct simplify_type { +template<> struct simplify_type< ::clang::QualType> { typedef const ::clang::Type *SimpleType; - static SimpleType getSimplifiedValue(const ::clang::QualType &Val) { + static SimpleType getSimplifiedValue(::clang::QualType &Val) { return Val.getTypePtr(); } }; -template<> struct simplify_type< ::clang::QualType> - : public simplify_type {}; // Teach SmallPtrSet that QualType is "basically a pointer". template<> diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index 611348f992..eb0e18ad84 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -841,17 +841,10 @@ namespace llvm { /// Implement simplify_type for CFGTerminator, so that we can dyn_cast from /// CFGTerminator to a specific Stmt class. -template <> struct simplify_type { - typedef const ::clang::Stmt *SimpleType; - static SimpleType getSimplifiedValue(const ::clang::CFGTerminator &Val) { - return Val.getStmt(); - } -}; - template <> struct simplify_type< ::clang::CFGTerminator> { typedef ::clang::Stmt *SimpleType; - static SimpleType getSimplifiedValue(const ::clang::CFGTerminator &Val) { - return const_cast(Val.getStmt()); + static SimpleType getSimplifiedValue(::clang::CFGTerminator &Val) { + return Val.getStmt(); } }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h index 1c67668618..092b41483d 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -1042,7 +1042,7 @@ namespace llvm { typedef const T *SimpleType; static SimpleType - getSimplifiedValue(const clang::ento::CallEventRef& Val) { + getSimplifiedValue(clang::ento::CallEventRef& Val) { return Val.getPtr(); } }; -- 2.40.0