]> granicus.if.org Git - clang/commitdiff
Fix the clang part of PR7952: rewrite the specialization of isa<> in DeclBase,
authorEli Friedman <eli.friedman@gmail.com>
Sat, 21 May 2011 19:15:39 +0000 (19:15 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 21 May 2011 19:15:39 +0000 (19:15 +0000)
and stop abusing the multi-level dereference isa<> used to allow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131804 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h
lib/CodeGen/CGStmt.cpp
lib/Frontend/CreateInvocationFromCommandLine.cpp

index ce48187f3ade52994e4c15abbac7f474e797bc1d..b5047b91c0e891f471edb3467293461595678caa 100644 (file)
@@ -1355,17 +1355,12 @@ struct cast_convert_decl_context<ToTy, true> {
 namespace llvm {
 
 /// isa<T>(DeclContext*)
-template<class ToTy>
-struct isa_impl_wrap<ToTy,
-                     const ::clang::DeclContext,const ::clang::DeclContext> {
+template <typename To>
+struct isa_impl<To, ::clang::DeclContext> {
   static bool doit(const ::clang::DeclContext &Val) {
-    return ToTy::classofKind(Val.getDeclKind());
+    return To::classofKind(Val.getDeclKind());
   }
 };
-template<class ToTy>
-struct isa_impl_wrap<ToTy, ::clang::DeclContext, ::clang::DeclContext>
-  : public isa_impl_wrap<ToTy,
-                      const ::clang::DeclContext,const ::clang::DeclContext> {};
 
 /// cast<T>(DeclContext*)
 template<class ToTy>
index 99bc3f49ce928d67bf7818d42c8895fc6d1f85cd..7a89bf024f7ff55d123ec0fbcbd8d81dfe88ec9f 100644 (file)
@@ -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<DeclStmt>(I);
+        HadSkippedDecl |= isa<DeclStmt>(*I);
         
         switch (CollectStatementsForCase(*I, Case, FoundCase, ResultStmts)) {
         case CSFC_Failure: return CSFC_Failure;
index 0005f910d21496e5294e8e59e9640f4d2bd13e5e..42b648aa6411ddf3e7c049064f26f11b9c55399f 100644 (file)
@@ -65,7 +65,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef<const char *> 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<driver::Command>(Jobs.begin())) {
+  if (Jobs.size() != 1 || !isa<driver::Command>(*Jobs.begin())) {
     llvm::SmallString<256> Msg;
     llvm::raw_svector_ostream OS(Msg);
     C->PrintJob(OS, C->getJobs(), "; ", true);