diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-07-18 11:55:33 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-07-18 11:55:33 +0000 |
commit | 4f8dc16fcdb6851c91b520d0ee595f5193ef51ef (patch) | |
tree | 001336fbdb293ef73980ee4ef4a0e4f324d288ef /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 8f5b44aead89a56c6fbf85ccfda03ae1e82ac431 (diff) | |
download | bcm5719-llvm-4f8dc16fcdb6851c91b520d0ee595f5193ef51ef.tar.gz bcm5719-llvm-4f8dc16fcdb6851c91b520d0ee595f5193ef51ef.zip |
Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCL
Reason: this commit causes crashes in the clang compiler when building
LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665
for details.
llvm-svn: 366429
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 9a6385f2831..dd77fc55721 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -8190,27 +8190,6 @@ void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *MethodD) { CheckCXXDefaultArguments(Method); } -// Emit the given diagnostic for each non-address-space qualifier. -// Common part of CheckConstructorDeclarator and CheckDestructorDeclarator. -static void checkMethodTypeQualifiers(Sema &S, Declarator &D, unsigned DiagID) { - const DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); - if (FTI.hasMethodTypeQualifiers() && !D.isInvalidType()) { - bool DiagOccured = false; - FTI.MethodQualifiers->forEachQualifier( - [DiagID, &S, &DiagOccured](DeclSpec::TQ, StringRef QualName, - SourceLocation SL) { - // This diagnostic should be emitted on any qualifier except an addr - // space qualifier. However, forEachQualifier currently doesn't visit - // addr space qualifiers, so there's no way to write this condition - // right now; we just diagnose on everything. - S.Diag(SL, DiagID) << QualName << SourceRange(SL); - DiagOccured = true; - }); - if (DiagOccured) - D.setInvalidType(); - } -} - /// CheckConstructorDeclarator - Called by ActOnDeclarator to check /// the well-formedness of the constructor declarator @p D with type @p /// R. If there are any errors in the declarator, this routine will @@ -8251,11 +8230,25 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, D.setInvalidType(); } - checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_constructor); + DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); + if (FTI.hasMethodTypeQualifiers()) { + bool DiagOccured = false; + FTI.MethodQualifiers->forEachQualifier( + [&](DeclSpec::TQ TypeQual, StringRef QualName, SourceLocation SL) { + // This diagnostic should be emitted on any qualifier except an addr + // space qualifier. However, forEachQualifier currently doesn't visit + // addr space qualifiers, so there's no way to write this condition + // right now; we just diagnose on everything. + Diag(SL, diag::err_invalid_qualified_constructor) + << QualName << SourceRange(SL); + DiagOccured = true; + }); + if (DiagOccured) + D.setInvalidType(); + } // C++0x [class.ctor]p4: // A constructor shall not be declared with a ref-qualifier. - DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (FTI.hasRefQualifier()) { Diag(FTI.getRefQualifierLoc(), diag::err_ref_qualifier_constructor) << FTI.RefQualifierIsLValueRef @@ -8430,11 +8423,18 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R, } } - checkMethodTypeQualifiers(*this, D, diag::err_invalid_qualified_destructor); + DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); + if (FTI.hasMethodTypeQualifiers() && !D.isInvalidType()) { + FTI.MethodQualifiers->forEachQualifier( + [&](DeclSpec::TQ TypeQual, StringRef QualName, SourceLocation SL) { + Diag(SL, diag::err_invalid_qualified_destructor) + << QualName << SourceRange(SL); + }); + D.setInvalidType(); + } // C++0x [class.dtor]p2: // A destructor shall not be declared with a ref-qualifier. - DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (FTI.hasRefQualifier()) { Diag(FTI.getRefQualifierLoc(), diag::err_ref_qualifier_destructor) << FTI.RefQualifierIsLValueRef |