diff options
author | cor3ntin <corentinjabot@gmail.com> | 2025-05-31 12:26:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-31 12:26:49 +0200 |
commit | 6f7268e204ed0a2c014324828e0582d90e8fcd04 (patch) | |
tree | 9a9913211ff75b1eb91f129e814dd31d6c43aa50 /clang/lib/Sema/SemaInit.cpp | |
parent | 3a989344741949be04bc2512a4633edc1c0e69d6 (diff) | |
download | llvm-6f7268e204ed0a2c014324828e0582d90e8fcd04.zip llvm-6f7268e204ed0a2c014324828e0582d90e8fcd04.tar.gz llvm-6f7268e204ed0a2c014324828e0582d90e8fcd04.tar.bz2 |
[Clang] Improve infrastructure for libstdc++ workarounds (#141977)
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.cpp | 7 |
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() |