r177053 - Fix an unused variable warning from Clang by sinking a dyn_cast into an

Chandler Carruth chandlerc at gmail.com
Thu Mar 14 04:17:20 PDT 2013


Author: chandlerc
Date: Thu Mar 14 06:17:20 2013
New Revision: 177053

URL: http://llvm.org/viewvc/llvm-project?rev=177053&view=rev
Log:
Fix an unused variable warning from Clang by sinking a dyn_cast into an
isa and a cast inside the assert. The efficiency concern isn't really
important here. The code should likely be cleaned up a bit more,
especially getting a message into the assert.

Please review Rafael.

Modified:
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=177053&r1=177052&r2=177053&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Mar 14 06:17:20 2013
@@ -3299,8 +3299,8 @@ void Redeclarable<decl_type>::setPreviou
 
   // First one will point to this one as latest.
   First->RedeclLink = LatestDeclLink(static_cast<decl_type*>(this));
-  if (NamedDecl *ND = dyn_cast<NamedDecl>(static_cast<decl_type*>(this)))
-    assert(ND->isLinkageValid());
+  assert(!isa<NamedDecl>(static_cast<decl_type*>(this)) ||
+         cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid());
 }
 
 // Inline function definitions.





More information about the cfe-commits mailing list