]> granicus.if.org Git - clang/commitdiff
Don't abuse reinterpret cast to do something the API of PointerUnion
authorChandler Carruth <chandlerc@gmail.com>
Mon, 2 May 2011 18:54:36 +0000 (18:54 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 2 May 2011 18:54:36 +0000 (18:54 +0000)
provides proper support for. This was caught by
-Wundefined-reinterpret-cast, and I think a reasonable case for it to
warn on.

Also use is<...> instead of dyn_cast<...> when the result isn't needed.

This whole thing should probably switch to using UsuallyTinyPtrVector.

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

lib/Sema/SemaLookup.cpp

index 309c7712d4cca09c087af839d1c6182013860afb..775b1d146ece6045f66f3143d2862c2cf3a31e5a 100644 (file)
@@ -2410,8 +2410,8 @@ VisibleDeclsRecord::ShadowMapEntry::end() {
   if (DeclOrVector.isNull())
     return 0;
 
-  if (DeclOrVector.dyn_cast<NamedDecl *>())
-    return &reinterpret_cast<NamedDecl*&>(DeclOrVector) + 1;
+  if (DeclOrVector.is<NamedDecl *>())
+    return DeclOrVector.getAddrOf<NamedDecl *>() + 1;
 
   return DeclOrVector.get<DeclVector *>()->end();
 }