[clang] [clang-tools-extra] [clang] SFINAE context refactor (PR #164703)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 22 13:52:24 PDT 2025
================
@@ -13626,15 +13620,10 @@ class Sema final : public SemaBase {
PrintInstantiationStack(getDefaultDiagFunc());
}
- /// Determines whether we are currently in a context where
- /// template argument substitution failures are not considered
- /// errors.
- ///
- /// \returns An empty \c Optional if we're not in a SFINAE context.
- /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
- /// template-deduction context object, which can be used to capture
- /// diagnostics that will be suppressed.
- std::optional<sema::TemplateDeductionInfo *> isSFINAEContext() const;
+ /// Returns a pointer to the current SFINAE context, if any.
+ [[nodiscard]] SFINAETrap *getSFINAEContext() const {
+ return CurrentSFINAEContext;
+ }
----------------
cor3ntin wrote:
Lets keep isSFINEAContext that returns `CurrentSFINAEContext != nullptr` to minimize the changes (I think it's also clearer that to do `if(getSFINAEContext())`
https://github.com/llvm/llvm-project/pull/164703
More information about the cfe-commits
mailing list