aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-01 15:29:53 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-01 15:29:53 +0000
commit4681ca84003bd52efbe05995a5a6853e4d9d6a60 (patch)
tree453b6a5c4978a67f34d11d7ab42f7336b008cd0f
parentc05babe58ca0fe825a2c4d362f132f409217e39a (diff)
Make loops infinitely faster. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107398 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 9273780536..94d00b2697 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2622,7 +2622,7 @@ namespace {
/// \brief Note that
void CalledDecl(CXXMethodDecl *Method) {
// If we already know that we allow all exceptions, do nothing.
- if (AllowsAllExceptions)
+ if (AllowsAllExceptions || !Method)
return;
const FunctionProtoType *Proto
@@ -2799,8 +2799,9 @@ void Sema::AddImplicitlyDeclaredMembersToClass(Scope *S,
// -- each direct base class B of X has a copy assignment operator
// whose parameter is of type const B&, const volatile B& or B,
// and
- for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
- HasConstCopyAssignment && Base != ClassDecl->bases_end(); ++Base) {
+ for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
+ BaseEnd = ClassDecl->bases_end();
+ HasConstCopyAssignment && Base != BaseEnd; ++Base) {
assert(!Base->getType()->isDependentType() &&
"Cannot generate implicit members for class with dependent bases.");
const CXXRecordDecl *BaseClassDecl
@@ -2814,8 +2815,9 @@ void Sema::AddImplicitlyDeclaredMembersToClass(Scope *S,
// type M (or array thereof), each such class type has a copy
// assignment operator whose parameter is of type const M&,
// const volatile M& or M.
- for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin();
- HasConstCopyAssignment && Field != ClassDecl->field_end();
+ for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
+ FieldEnd = ClassDecl->field_end();
+ HasConstCopyAssignment && Field != FieldEnd;
++Field) {
QualType FieldType = (*Field)->getType();
if (const ArrayType *Array = Context.getAsArrayType(FieldType))