mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Recognize C++17 deduction guides feature test macro and pass it via TU
This commit is contained in:
parent
2eaaa1ef0b
commit
aafb1d951a
3 changed files with 30 additions and 0 deletions
|
@ -46,4 +46,18 @@ public interface ICPPASTTranslationUnit extends IASTTranslationUnit {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTTranslationUnit copy(CopyStyle style);
|
public ICPPASTTranslationUnit copy(CopyStyle style);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this AST should enable class template argument deduction.
|
||||||
|
*
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public void setEnableClassTemplateArgumentDeduction(boolean flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this AST should enable class template argument deduction.
|
||||||
|
*
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public boolean getEnableClassTemplateArgumentDeduction();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
private ICPPNamespace fBinding;
|
private ICPPNamespace fBinding;
|
||||||
private final CPPScopeMapper fScopeMapper;
|
private final CPPScopeMapper fScopeMapper;
|
||||||
private CPPASTAmbiguityResolver fAmbiguityResolver;
|
private CPPASTAmbiguityResolver fAmbiguityResolver;
|
||||||
|
private boolean fEnableClassTemplateArgumentDeduction;
|
||||||
|
|
||||||
// Caches.
|
// Caches.
|
||||||
private final Map<ICPPClassType, FinalOverriderMap> fFinalOverriderMapCache = new HashMap<>();
|
private final Map<ICPPClassType, FinalOverriderMap> fFinalOverriderMapCache = new HashMap<>();
|
||||||
|
@ -78,6 +79,7 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
@Override
|
@Override
|
||||||
public CPPASTTranslationUnit copy(CopyStyle style) {
|
public CPPASTTranslationUnit copy(CopyStyle style) {
|
||||||
CPPASTTranslationUnit copy = new CPPASTTranslationUnit();
|
CPPASTTranslationUnit copy = new CPPASTTranslationUnit();
|
||||||
|
copy.setEnableClassTemplateArgumentDeduction(getEnableClassTemplateArgumentDeduction());
|
||||||
return copy(copy, style);
|
return copy(copy, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,4 +280,14 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
public ICPPClassTemplatePartialSpecialization mapToAST(ICPPClassTemplatePartialSpecialization indexSpec) {
|
public ICPPClassTemplatePartialSpecialization mapToAST(ICPPClassTemplatePartialSpecialization indexSpec) {
|
||||||
return fScopeMapper.mapToAST(indexSpec);
|
return fScopeMapper.mapToAST(indexSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnableClassTemplateArgumentDeduction(boolean flag) {
|
||||||
|
fEnableClassTemplateArgumentDeduction = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getEnableClassTemplateArgumentDeduction() {
|
||||||
|
return fEnableClassTemplateArgumentDeduction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
private final boolean supportGCCStyleDesignators;
|
private final boolean supportGCCStyleDesignators;
|
||||||
private final boolean supportFoldExpression;
|
private final boolean supportFoldExpression;
|
||||||
private final boolean supportChar8TypeLiterals;
|
private final boolean supportChar8TypeLiterals;
|
||||||
|
private final boolean supportClassTemplateArgumentDeduction;
|
||||||
|
|
||||||
private final IIndex index;
|
private final IIndex index;
|
||||||
protected ICPPASTTranslationUnit translationUnit;
|
protected ICPPASTTranslationUnit translationUnit;
|
||||||
|
@ -249,6 +250,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
additionalNumericalSuffixes = scanner.getAdditionalNumericLiteralSuffixes();
|
additionalNumericalSuffixes = scanner.getAdditionalNumericLiteralSuffixes();
|
||||||
supportFoldExpression = true;
|
supportFoldExpression = true;
|
||||||
supportChar8TypeLiterals = scanner.getMacroDefinitions().containsKey("__cpp_char8_t"); //$NON-NLS-1$
|
supportChar8TypeLiterals = scanner.getMacroDefinitions().containsKey("__cpp_char8_t"); //$NON-NLS-1$
|
||||||
|
supportClassTemplateArgumentDeduction = scanner.getMacroDefinitions().containsKey("__cpp_deduction_guides"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5572,6 +5574,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
((ASTTranslationUnit) translationUnit).setupBuiltinBindings(builtinBindingsProvider);
|
((ASTTranslationUnit) translationUnit).setupBuiltinBindings(builtinBindingsProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
translationUnit.setEnableClassTemplateArgumentDeduction(supportClassTemplateArgumentDeduction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void consumeArrayModifiers(DeclarationOptions option, List<IASTArrayModifier> collection)
|
private void consumeArrayModifiers(DeclarationOptions option, List<IASTArrayModifier> collection)
|
||||||
|
|
Loading…
Add table
Reference in a new issue