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/SemaExceptionSpec.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/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index c83eab5..c692f82 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -18,6 +18,7 @@ #include "clang/AST/TypeLoc.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" +#include "clang/Lex/Preprocessor.h" #include "clang/Sema/SemaInternal.h" #include "llvm/ADT/SmallPtrSet.h" #include <optional> @@ -44,6 +45,8 @@ static const FunctionProtoType *GetUnderlyingFunction(QualType T) bool Sema::isLibstdcxxEagerExceptionSpecHack(const Declarator &D) { auto *RD = dyn_cast<CXXRecordDecl>(CurContext); + if (!getPreprocessor().NeedsStdLibCxxWorkaroundBefore(2016'04'27)) + return false; // All the problem cases are member functions named "swap" within class // templates declared directly within namespace std or std::__debug or // std::__profile. |