Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ C++ Specific Potentially Breaking Changes
- The type trait builtin ``__is_referenceable`` has been removed, since it has
very few users and all the type traits that could benefit from it in the
standard library already have their own bespoke builtins.
- A workaround for libstdc++4.7 has been removed. Note that 4.8.3 remains the oldest
supported libstdc++ version.

ABI Changes in This Version
---------------------------
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4024,13 +4024,14 @@ void Parser::ParseDeclarationSpecifiers(
}

case tok::kw___is_signed:
// GNU libstdc++ 4.4 uses __is_signed as an identifier, but Clang
// typically treats it as a trait. If we see __is_signed as it appears
// in libstdc++, e.g.,
// HACK: before 2022-12, libstdc++ uses __is_signed as an identifier,
// but Clang typically treats it as a trait.
// If we see __is_signed as it appears in libstdc++, e.g.,
//
// static const bool __is_signed;
//
// then treat __is_signed as an identifier rather than as a keyword.
// This was fixed by libstdc++ in December 2022.
if (DS.getTypeSpecType() == TST_bool &&
DS.getTypeQualifiers() == DeclSpec::TQ_const &&
DS.getStorageClassSpec() == DeclSpec::SCS_static)
Expand Down
38 changes: 9 additions & 29 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,11 +637,11 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc,
}

InitializationSequence InitSeq(SemaRef, Entity, Kind, SubInit);
// libstdc++4.6 marks the vector default constructor as explicit in
// _GLIBCXX_DEBUG mode, so recover using the C++03 logic in that case.
// stlport does so too. Look for std::__debug for libstdc++, and for
// std:: for stlport. This is effectively a compiler-side implementation of
// LWG2193.
// HACK: libstdc++ prior to 4.9 marks the vector default constructor
// as explicit in _GLIBCXX_DEBUG mode, so recover using the C++03 logic
// in that case. stlport does so too.
// Look for std::__debug for libstdc++, and for std:: for stlport.
// This is effectively a compiler-side implementation of LWG2193.
if (!InitSeq && EmptyInitList && InitSeq.getFailureKind() ==
InitializationSequence::FK_ExplicitConstructor) {
OverloadCandidateSet::iterator Best;
Expand Down Expand Up @@ -6240,24 +6240,6 @@ static void TryUserDefinedConversion(Sema &S,
}
}

/// An egregious hack for compatibility with libstdc++-4.2: in <tr1/hashtable>,
/// a function with a pointer return type contains a 'return false;' statement.
/// In C++11, 'false' is not a null pointer, so this breaks the build of any
/// code using that header.
///
/// Work around this by treating 'return false;' as zero-initializing the result
/// if it's used in a pointer-returning function in a system header.
static bool isLibstdcxxPointerReturnFalseHack(Sema &S,
const InitializedEntity &Entity,
const Expr *Init) {
return S.getLangOpts().CPlusPlus11 &&
Entity.getKind() == InitializedEntity::EK_Result &&
Entity.getType()->isPointerType() &&
isa<CXXBoolLiteralExpr>(Init) &&
!cast<CXXBoolLiteralExpr>(Init)->getValue() &&
S.getSourceManager().isInSystemHeader(Init->getExprLoc());
}

/// The non-zero enum values here are indexes into diagnostic alternatives.
enum InvalidICRKind { IIK_okay, IIK_nonlocal, IIK_nonscalar };

Expand Down Expand Up @@ -6943,12 +6925,10 @@ void InitializationSequence::InitializeFrom(Sema &S,

AddPassByIndirectCopyRestoreStep(DestType, ShouldCopy);
} else if (ICS.isBad()) {
if (isLibstdcxxPointerReturnFalseHack(S, Entity, Initializer))
AddZeroInitializationStep(Entity.getType());
else if (DeclAccessPair Found;
Initializer->getType() == Context.OverloadTy &&
!S.ResolveAddressOfOverloadedFunction(Initializer, DestType,
/*Complain=*/false, Found))
if (DeclAccessPair Found;
Initializer->getType() == Context.OverloadTy &&
!S.ResolveAddressOfOverloadedFunction(Initializer, DestType,
/*Complain=*/false, Found))
SetFailed(InitializationSequence::FK_AddressOfOverloadFailed);
else if (Initializer->getType()->isFunctionType() &&
isExprAnUnaddressableFunction(S, Initializer))
Expand Down
28 changes: 0 additions & 28 deletions clang/test/SemaCXX/libstdcxx_gets_hack.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions clang/test/SemaCXX/libstdcxx_pointer_return_false_hack.cpp

This file was deleted.