forked from OSchip/llvm-project
Revert "Fix missed exception spec checks and crashes"
The changes caused the sanitizer bot to hang: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/2311 Needs investigation. This reverts commit r192914. llvm-svn: 192921
This commit is contained in:
parent
a0191d1101
commit
be2a55f5ac
|
@ -4789,7 +4789,7 @@ public:
|
||||||
void CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD);
|
void CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD);
|
||||||
void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD,
|
void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD,
|
||||||
const FunctionProtoType *T);
|
const FunctionProtoType *T);
|
||||||
void CheckDelayedMemberExceptionSpecs();
|
void CheckDelayedExplicitlyDefaultedMemberExceptionSpecs();
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// C++ Derived Classes
|
// C++ Derived Classes
|
||||||
|
|
|
@ -792,11 +792,6 @@ void Sema::ActOnEndOfTranslationUnit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All delayed member exception specs should be checked or we end up accepting
|
|
||||||
// incompatible declarations.
|
|
||||||
assert(DelayedDefaultedMemberExceptionSpecs.empty());
|
|
||||||
assert(DelayedDestructorExceptionSpecChecks.empty());
|
|
||||||
|
|
||||||
// Check we've noticed that we're no longer parsing the initializer for every
|
// Check we've noticed that we're no longer parsing the initializer for every
|
||||||
// variable. If we miss cases, then at best we have a performance issue and
|
// variable. If we miss cases, then at best we have a performance issue and
|
||||||
// at worst a rejects-valid bug.
|
// at worst a rejects-valid bug.
|
||||||
|
|
|
@ -4864,27 +4864,14 @@ void Sema::CheckExplicitlyDefaultedMemberExceptionSpec(
|
||||||
SpecifiedType, MD->getLocation());
|
SpecifiedType, MD->getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::CheckDelayedMemberExceptionSpecs() {
|
void Sema::CheckDelayedExplicitlyDefaultedMemberExceptionSpecs() {
|
||||||
// Perform any deferred checking of exception specifications for virtual
|
for (unsigned I = 0, N = DelayedDefaultedMemberExceptionSpecs.size();
|
||||||
// destructors.
|
I != N; ++I)
|
||||||
while (!DelayedDestructorExceptionSpecChecks.empty()) {
|
CheckExplicitlyDefaultedMemberExceptionSpec(
|
||||||
std::pair<const CXXDestructorDecl *, const CXXDestructorDecl *> Check =
|
DelayedDefaultedMemberExceptionSpecs[I].first,
|
||||||
DelayedDestructorExceptionSpecChecks.pop_back_val();
|
DelayedDefaultedMemberExceptionSpecs[I].second);
|
||||||
const CXXDestructorDecl *Dtor = Check.first;
|
|
||||||
assert(!Dtor->getParent()->isDependentType() &&
|
|
||||||
"Should not ever add destructors of templates into the list.");
|
|
||||||
CheckOverridingFunctionExceptionSpec(Dtor, Check.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that any explicitly-defaulted methods have exception specifications
|
DelayedDefaultedMemberExceptionSpecs.clear();
|
||||||
// compatible with their implicit exception specifications.
|
|
||||||
while (!DelayedDefaultedMemberExceptionSpecs.empty()) {
|
|
||||||
std::pair<CXXMethodDecl *, const FunctionProtoType *> Spec =
|
|
||||||
DelayedDefaultedMemberExceptionSpecs.pop_back_val();
|
|
||||||
CheckExplicitlyDefaultedMemberExceptionSpec(Spec.first, Spec.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(DelayedDestructorExceptionSpecChecks.empty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -8195,8 +8182,9 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::ActOnFinishDelayedMemberInitializers(Decl *D) {
|
void Sema::ActOnFinishDelayedMemberInitializers(Decl *D) {
|
||||||
// Perform any delayed checks on exception specifications.
|
// Check that any explicitly-defaulted methods have exception specifications
|
||||||
CheckDelayedMemberExceptionSpecs();
|
// compatible with their implicit exception specifications.
|
||||||
|
CheckDelayedExplicitlyDefaultedMemberExceptionSpecs();
|
||||||
|
|
||||||
// Once all the member initializers are processed, perform checks to see if
|
// Once all the member initializers are processed, perform checks to see if
|
||||||
// any unintialized use is happeneing.
|
// any unintialized use is happeneing.
|
||||||
|
@ -8719,11 +8707,23 @@ void Sema::ActOnFinishCXXMemberDecls() {
|
||||||
// If the context is an invalid C++ class, just suppress these checks.
|
// If the context is an invalid C++ class, just suppress these checks.
|
||||||
if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(CurContext)) {
|
if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(CurContext)) {
|
||||||
if (Record->isInvalidDecl()) {
|
if (Record->isInvalidDecl()) {
|
||||||
DelayedDefaultedMemberExceptionSpecs.clear();
|
|
||||||
DelayedDestructorExceptionSpecChecks.clear();
|
DelayedDestructorExceptionSpecChecks.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform any deferred checking of exception specifications for virtual
|
||||||
|
// destructors.
|
||||||
|
for (unsigned i = 0, e = DelayedDestructorExceptionSpecChecks.size();
|
||||||
|
i != e; ++i) {
|
||||||
|
const CXXDestructorDecl *Dtor =
|
||||||
|
DelayedDestructorExceptionSpecChecks[i].first;
|
||||||
|
assert(!Dtor->getParent()->isDependentType() &&
|
||||||
|
"Should not ever add destructors of templates into the list.");
|
||||||
|
CheckOverridingFunctionExceptionSpec(Dtor,
|
||||||
|
DelayedDestructorExceptionSpecChecks[i].second);
|
||||||
|
}
|
||||||
|
DelayedDestructorExceptionSpecChecks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::AdjustDestructorExceptionSpec(CXXRecordDecl *ClassDecl,
|
void Sema::AdjustDestructorExceptionSpec(CXXRecordDecl *ClassDecl,
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
|
|
||||||
// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -DCXX_EXCEPTIONS -fsyntax-only -verify %s
|
|
||||||
|
|
||||||
template <class _Tp> struct is_nothrow_move_constructible {
|
|
||||||
static const bool value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
class allocator;
|
|
||||||
|
|
||||||
template <>
|
|
||||||
class allocator<char> {};
|
|
||||||
|
|
||||||
template <class _Allocator>
|
|
||||||
class basic_string {
|
|
||||||
typedef _Allocator allocator_type;
|
|
||||||
basic_string(basic_string &&__str)
|
|
||||||
noexcept(is_nothrow_move_constructible<allocator_type>::value);
|
|
||||||
};
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
Foo(Foo &&) noexcept = default;
|
|
||||||
#ifdef CXX_EXCEPTIONS
|
|
||||||
// expected-error@-2 {{does not match the calculated}}
|
|
||||||
#else
|
|
||||||
// expected-no-diagnostics
|
|
||||||
#endif
|
|
||||||
Foo &operator=(Foo &&) noexcept = default;
|
|
||||||
basic_string<allocator<char> > vectorFoo_;
|
|
||||||
};
|
|
Loading…
Reference in New Issue