1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 514821 - Attribute on enumerator

Change-Id: Icb9ff49c16b049fecb33a55e1db11b61f1efc2d9
This commit is contained in:
Nathan Ridge 2017-04-08 02:46:28 -04:00
parent e42a75e3e5
commit 8b8ceed800
4 changed files with 14 additions and 2 deletions

View file

@ -12252,4 +12252,12 @@ public class AST2CPPTests extends AST2TestBase {
ICPPFunctionType logicalNotType = logicalNotOverload.getType();
isTypeEqual(logicalNotType, "bool (bool)");
}
// enum enumDecl {
// el0 __attribute__((deprecated)),
// el1,
// };
public void testEnumeratorAttribute_514821() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true /* use GNU extensions */);
}
}

View file

@ -22,7 +22,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
public interface IASTEnumerator extends IASTNameOwner, IASTAttributeOwner {
/**
* Empty array (constant).
*/

View file

@ -30,7 +30,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
/**
* Base class for C and C++ enumerators.
*/
public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, IASTAmbiguityParent {
public abstract class ASTEnumerator extends ASTAttributeOwner implements IASTEnumerator, IASTAmbiguityParent {
private IASTName name;
private IASTExpression value;
private IValue integralValue;

View file

@ -1565,6 +1565,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
final IASTEnumerator enumerator= nodeFactory.newEnumerator(etorName, null);
endOffset= calculateEndOffset(etorName);
setRange(enumerator, problemOffset, endOffset);
List<IASTAttributeSpecifier> attributes = __attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
addAttributeSpecifiers(attributes, enumerator);
result.addEnumerator(enumerator);
if (LTcatchEOF(1) == IToken.tASSIGN) {
problemOffset= consume().getOffset();