diff options
| author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-03 16:10:26 +0000 |
|---|---|---|
| committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-03 16:10:26 +0000 |
| commit | fb04e1b40c5b87514ad84d7b85ad7528b353bdc1 (patch) | |
| tree | b810ed4fc27d75413a403f7986fd88976a272d0e | |
| parent | 18aa3bb8197d4cbc58dfc6744adb8038f9b57cfb (diff) | |
| download | bcm5719-llvm-fb04e1b40c5b87514ad84d7b85ad7528b353bdc1.tar.gz bcm5719-llvm-fb04e1b40c5b87514ad84d7b85ad7528b353bdc1.zip | |
Remove unneeded const_casts
llvm-svn: 174287
| -rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/ASTMatchers/ASTMatchers.h | 8 | ||||
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 6 |
3 files changed, 7 insertions, 13 deletions
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index e5e69af0497..547490dea37 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -1464,8 +1464,7 @@ public: = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>()) return PartialSpec->PartialSpecialization; - return const_cast<ClassTemplateDecl*>( - SpecializedTemplate.get<ClassTemplateDecl*>()); + return SpecializedTemplate.get<ClassTemplateDecl*>(); } /// \brief Retrieve the class template or class template partial @@ -1477,8 +1476,7 @@ public: = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>()) return PartialSpec->PartialSpecialization; - return const_cast<ClassTemplateDecl*>( - SpecializedTemplate.get<ClassTemplateDecl*>()); + return SpecializedTemplate.get<ClassTemplateDecl*>(); } /// \brief Retrieve the set of template arguments that should be used diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index ffffe52c2ca..9dbd5d18d90 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1501,9 +1501,8 @@ inline internal::PolymorphicMatcherWithParam1< internal::HasDeclarationMatcher, /// FIXME: Overload to allow directly matching types? AST_MATCHER_P(CXXMemberCallExpr, on, internal::Matcher<Expr>, InnerMatcher) { - const Expr *ExprNode = const_cast<CXXMemberCallExpr&>(Node) - .getImplicitObjectArgument() - ->IgnoreParenImpCasts(); + const Expr *ExprNode = Node.getImplicitObjectArgument() + ->IgnoreParenImpCasts(); return (ExprNode != NULL && InnerMatcher.matches(*ExprNode, Finder, Builder)); } @@ -1649,8 +1648,7 @@ inline internal::Matcher<QualType> references( AST_MATCHER_P(CXXMemberCallExpr, onImplicitObjectArgument, internal::Matcher<Expr>, InnerMatcher) { - const Expr *ExprNode = - const_cast<CXXMemberCallExpr&>(Node).getImplicitObjectArgument(); + const Expr *ExprNode = Node.getImplicitObjectArgument(); return (ExprNode != NULL && InnerMatcher.matches(*ExprNode, Finder, Builder)); } diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index ed2a0c36fd2..cdf921de4af 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -587,8 +587,7 @@ void NamedDecl::ClearLinkageCache() { if (const CXXRecordDecl *record = dyn_cast<CXXRecordDecl>(this)) clearLinkageForClass(record); - if (ClassTemplateDecl *temp = - dyn_cast<ClassTemplateDecl>(const_cast<NamedDecl*>(this))) { + if (ClassTemplateDecl *temp = dyn_cast<ClassTemplateDecl>(this)) { // Clear linkage for the template pattern. CXXRecordDecl *record = temp->getTemplatedDecl(); record->HasCachedLinkage = 0; @@ -601,8 +600,7 @@ void NamedDecl::ClearLinkageCache() { } // Clear cached linkage for function template decls, too. - if (FunctionTemplateDecl *temp = - dyn_cast<FunctionTemplateDecl>(const_cast<NamedDecl*>(this))) { + if (FunctionTemplateDecl *temp = dyn_cast<FunctionTemplateDecl>(this)) { temp->getTemplatedDecl()->ClearLinkageCache(); for (FunctionTemplateDecl::spec_iterator i = temp->spec_begin(), e = temp->spec_end(); i != e; ++i) |

