[cfe-commits] r72624 - in /cfe/trunk: lib/Sema/SemaInherit.cpp test/SemaCXX/abstract.cpp
Anders Carlsson
andersca at mac.com
Sat May 30 10:26:42 PDT 2009
Author: andersca
Date: Sat May 30 12:26:39 2009
New Revision: 72624
URL: http://llvm.org/viewvc/llvm-project?rev=72624&view=rev
Log:
Replace a cast with a dyn_cast as suggested by Doug.
Modified:
cfe/trunk/lib/Sema/SemaInherit.cpp
cfe/trunk/test/SemaCXX/abstract.cpp
Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=72624&r1=72623&r2=72624&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInherit.cpp Sat May 30 12:26:39 2009
@@ -195,13 +195,14 @@
Paths.ScratchPath.Decls =
BaseRecord->lookup(Context, Criteria.Method->getDeclName());
while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) {
- CXXMethodDecl *MD =
- cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first);
-
- OverloadedFunctionDecl::function_iterator MatchedDecl;
- if (MD->isVirtual() && !IsOverload(Criteria.Method, MD, MatchedDecl)) {
- FoundPathToThisBase = true;
- break;
+ if (CXXMethodDecl *MD =
+ dyn_cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first)) {
+ OverloadedFunctionDecl::function_iterator MatchedDecl;
+ if (MD->isVirtual() &&
+ !IsOverload(Criteria.Method, MD, MatchedDecl)) {
+ FoundPathToThisBase = true;
+ break;
+ }
}
++Paths.ScratchPath.Decls.first;
Modified: cfe/trunk/test/SemaCXX/abstract.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/abstract.cpp?rev=72624&r1=72623&r2=72624&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/abstract.cpp (original)
+++ cfe/trunk/test/SemaCXX/abstract.cpp Sat May 30 12:26:39 2009
@@ -118,3 +118,11 @@
B b;
}
+struct K {
+ int f;
+ virtual ~K();
+};
+
+struct L : public K {
+ void f();
+};
More information about the cfe-commits
mailing list