From e08bca9eb48bc11ce5d3b66cd239f2b41c9d48fb Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 21 May 2011 19:15:39 +0000 Subject: [PATCH] Fix the clang part of PR7952: rewrite the specialization of isa<> in DeclBase, and stop abusing the multi-level dereference isa<> used to allow. llvm-svn: 131804 --- clang/include/clang/AST/DeclBase.h | 11 +++-------- clang/lib/CodeGen/CGStmt.cpp | 2 +- .../lib/Frontend/CreateInvocationFromCommandLine.cpp | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index ce48187f3ade..b5047b91c0e8 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1355,17 +1355,12 @@ struct cast_convert_decl_context { namespace llvm { /// isa(DeclContext*) -template -struct isa_impl_wrap { +template +struct isa_impl { static bool doit(const ::clang::DeclContext &Val) { - return ToTy::classofKind(Val.getDeclKind()); + return To::classofKind(Val.getDeclKind()); } }; -template -struct isa_impl_wrap - : public isa_impl_wrap {}; /// cast(DeclContext*) template diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 99bc3f49ce92..7a89bf024f7f 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -999,7 +999,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, // If we're looking for the case, just see if we can skip each of the // substatements. for (; Case && I != E; ++I) { - HadSkippedDecl |= isa(I); + HadSkippedDecl |= isa(*I); switch (CollectStatementsForCase(*I, Case, FoundCase, ResultStmts)) { case CSFC_Failure: return CSFC_Failure; diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 0005f910d214..42b648aa6411 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -65,7 +65,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef ArgList, // We expect to get back exactly one command job, if we didn't something // failed. const driver::JobList &Jobs = C->getJobs(); - if (Jobs.size() != 1 || !isa(Jobs.begin())) { + if (Jobs.size() != 1 || !isa(*Jobs.begin())) { llvm::SmallString<256> Msg; llvm::raw_svector_ostream OS(Msg); C->PrintJob(OS, C->getJobs(), "; ", true);