@@ -1876,6 +1876,9 @@ class ASTVisitor
1876
1876
std::optional<std::pair<QualType, std::vector<TemplateArgument>>>
1877
1877
isSFINAEType (QualType T)
1878
1878
{
1879
+ if (! config_->detectSfinae )
1880
+ return std::nullopt;
1881
+
1879
1882
auto sfinae_info = getSFINAETemplate (T, true );
1880
1883
if (! sfinae_info)
1881
1884
return std::nullopt;
@@ -1904,6 +1907,12 @@ class ASTVisitor
1904
1907
return std::make_pair (param_arg->getAsType (), std::move (ControllingArgs));
1905
1908
}
1906
1909
1910
+ std::optional<std::pair<QualType, std::vector<TemplateArgument>>>
1911
+ isSFINAEType (const Type* T)
1912
+ {
1913
+ return isSFINAEType (QualType (T, 0 ));
1914
+ }
1915
+
1907
1916
std::string extractName (DeclarationName N)
1908
1917
{
1909
1918
std::string result;
@@ -3849,6 +3858,9 @@ class TerminalTypeVisitor
3849
3858
VisitDependentNameType (
3850
3859
const DependentNameType* T)
3851
3860
{
3861
+ if (auto SFINAE = getASTVisitor ().isSFINAEType (T); SFINAE.has_value ())
3862
+ return getDerived ().Visit (SFINAE->first );
3863
+
3852
3864
if (auto * NNS = T->getQualifier ())
3853
3865
NNS_ = NNS;
3854
3866
getDerived ().buildTerminal (NNS_, T->getIdentifier (),
@@ -3871,6 +3883,9 @@ class TerminalTypeVisitor
3871
3883
VisitTemplateSpecializationType (
3872
3884
const TemplateSpecializationType* T)
3873
3885
{
3886
+ if (auto SFINAE = getASTVisitor ().isSFINAEType (T); SFINAE.has_value ())
3887
+ return getDerived ().Visit (SFINAE->first );
3888
+
3874
3889
TemplateName TN = T->getTemplateName ();
3875
3890
MRDOCS_ASSERT (! TN.isNull ());
3876
3891
NamedDecl* ND = TN.getAsTemplateDecl ();
@@ -4296,13 +4311,6 @@ buildTypeInfo(
4296
4311
ExtractionScope scope = enterMode (extract_mode);
4297
4312
// build the TypeInfo representation for the type
4298
4313
TypeInfoBuilder Builder (*this );
4299
-
4300
- if (config_->detectSfinae )
4301
- {
4302
- if (auto SFINAE = isSFINAEType (qt); SFINAE.has_value ())
4303
- qt = SFINAE->first .withFastQualifiers (qt.getLocalFastQualifiers ());
4304
- }
4305
-
4306
4314
Builder.Visit (qt);
4307
4315
return Builder.result ();
4308
4316
}
0 commit comments