[cfe-commits] r49603 - /cfe/trunk/lib/AST/Decl.cpp

Sam Bishop sam at bishop.dhs.org
Sat Apr 12 21:32:19 PDT 2008


Author: sbishop
Date: Sat Apr 12 23:32:18 2008
New Revision: 49603

URL: http://llvm.org/viewvc/llvm-project?rev=49603&view=rev
Log:
Use static_cast<> instead of cast<> in Decl::Destroy().  Suggestion by Argiris
Kirtzidis!

Modified:
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=49603&r1=49602&r2=49603&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sat Apr 12 23:32:18 2008
@@ -329,7 +329,10 @@
   return (*DeclAttrs)[this];
 }
 
-#define CASE(KIND) case KIND: cast<KIND##Decl>(this)->~KIND##Decl(); break
+#define CASE(KIND) \
+  case KIND: \
+    static_cast<KIND##Decl *>(const_cast<Decl *>(this))->~KIND##Decl(); \
+    break
 
 void Decl::Destroy(ASTContext& C) const {
   switch (getKind()) {
@@ -355,7 +358,7 @@
   CASE(LinkageSpec);
 
   case Struct: case Union: case Class:
-    cast<RecordDecl>(this)->~RecordDecl();
+    static_cast<RecordDecl *>(const_cast<Decl *>(this))->~RecordDecl();
     break;
 
   default: assert(0 && "Unknown decl kind!");





More information about the cfe-commits mailing list