aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorcor3ntin <corentinjabot@gmail.com>2025-06-03 14:22:54 +0200
committerGitHub <noreply@github.com>2025-06-03 14:22:54 +0200
commitc9968f4a04e055353f0667a16bcf34f1b3d855a5 (patch)
treeba967ced23066d241a59260ad270c3f2f416ec18 /clang/lib/Sema/SemaInit.cpp
parentec96c0c072ef3f78813c378949c00e1c07aa44e5 (diff)
downloadllvm-c9968f4a04e055353f0667a16bcf34f1b3d855a5.zip
llvm-c9968f4a04e055353f0667a16bcf34f1b3d855a5.tar.gz
llvm-c9968f4a04e055353f0667a16bcf34f1b3d855a5.tar.bz2
[Clang] Improve infrastructure for libstdc++ workarounds (Reland) (#142592)
Reland with debug traces to try to understand a bug that only happens on one CI configuration === This introduces a way detect the libstdc++ version, use that to enable workarounds. The version is cached. This should make it easier in the future to find and remove these hacks. I did not find the need for enabling a hack between or after specific versions, so it's left as a future exercise. We can extend this fature to other libraries as the need arise. ===
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 776cb02..5d870f07 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -21,6 +21,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Designator.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
@@ -641,8 +642,10 @@ ExprResult InitListChecker::PerformEmptyInit(SourceLocation Loc,
// 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) {
+ if (!InitSeq && EmptyInitList &&
+ InitSeq.getFailureKind() ==
+ InitializationSequence::FK_ExplicitConstructor &&
+ SemaRef.getPreprocessor().NeedsStdLibCxxWorkaroundBefore(2014'04'22)) {
OverloadCandidateSet::iterator Best;
OverloadingResult O =
InitSeq.getFailedCandidateSet()