[cfe-commits] r61388 - /cfe/trunk/lib/AST/DeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Tue Dec 23 13:31:30 PST 2008
Author: dgregor
Date: Tue Dec 23 15:31:30 2008
New Revision: 61388
URL: http://llvm.org/viewvc/llvm-project?rev=61388&view=rev
Log:
When determining whether a class type has a const copy constructor, be
sure to look at all of the results returned by name lookup. Fixes
<rdar://problem/6465262>
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=61388&r1=61387&r2=61388&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Tue Dec 23 15:31:30 2008
@@ -14,6 +14,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/IdentifierTable.h"
+#include "llvm/ADT/STLExtras.h"
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -80,24 +81,14 @@
= Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(ClassType));
unsigned TypeQuals;
- DeclContext::lookup_const_result Lookup
- = this->lookup(Context, ConstructorName);
- if (Lookup.first == Lookup.second)
- return false;
- else if (OverloadedFunctionDecl *Constructors
- = dyn_cast<OverloadedFunctionDecl>(*Lookup.first)) {
- for (OverloadedFunctionDecl::function_const_iterator Con
- = Constructors->function_begin();
- Con != Constructors->function_end(); ++Con) {
+ DeclContext::lookup_const_iterator Con, ConEnd;
+ for (llvm::tie(Con, ConEnd) = this->lookup(Context, ConstructorName);
+ Con != ConEnd; ++Con) {
if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, TypeQuals) &&
(TypeQuals & QualType::Const) != 0)
return true;
- }
- } else if (CXXConstructorDecl *Constructor
- = dyn_cast<CXXConstructorDecl>(*Lookup.first)) {
- return Constructor->isCopyConstructor(Context, TypeQuals) &&
- (TypeQuals & QualType::Const) != 0;
}
+
return false;
}
More information about the cfe-commits
mailing list