mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Bug 522509 - Handle typedefs in __is_class builtin
Change-Id: Ief3efa8e660ab1f7ec11788be8dad69da2501aa6
This commit is contained in:
parent
ef5147a046
commit
2aeb75d147
2 changed files with 10 additions and 4 deletions
|
@ -12387,4 +12387,12 @@ public class AST2CPPTests extends AST2CPPTestBase {
|
||||||
public void testNamespaceAliasNamespaceWithPreviousFunctionName_517402() throws Exception {
|
public void testNamespaceAliasNamespaceWithPreviousFunctionName_517402() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// class C {};
|
||||||
|
// typedef C D;
|
||||||
|
// constexpr bool waldo = __is_class(D);
|
||||||
|
public void testIsClassBuiltinOnTypedef_522509() throws Exception {
|
||||||
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
helper.assertVariableValue("waldo", 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_is_union;
|
||||||
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_sizeof;
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_sizeof;
|
||||||
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeid;
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeid;
|
||||||
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeof;
|
import static org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression.op_typeof;
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
|
@ -51,7 +52,6 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
@ -390,9 +390,7 @@ public class ValueFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IValue applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) {
|
private static IValue applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) {
|
||||||
while (type instanceof IQualifierType) {
|
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE);
|
||||||
type = ((IQualifierType) type).getType();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case op_sizeof:
|
case op_sizeof:
|
||||||
|
|
Loading…
Add table
Reference in a new issue