mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Devin Steffler.
Fixed 77009 - ASTUtil#getType ignores volatile
This commit is contained in:
parent
9a38e1a718
commit
552b75eb26
2 changed files with 13 additions and 0 deletions
|
@ -19,7 +19,9 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTUtil;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
|
@ -2341,5 +2343,14 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
writer.write("temp = (TYPE*)(pType + 1); /* Parser error is here */\n}\n"); //$NON-NLS-1$
|
||||
parse(writer.toString());
|
||||
}
|
||||
|
||||
public void testBug77009() throws Exception
|
||||
{
|
||||
Iterator i = parse("int foo(volatile int &);\n").getDeclarations(); //$NON-NLS-1$
|
||||
IASTFunction foo = (IASTFunction) i.next();
|
||||
Iterator parms = foo.getParameters();
|
||||
IASTParameterDeclaration blank = (IASTParameterDeclaration)parms.next();
|
||||
assertEquals( ASTUtil.getType( (IASTAbstractDeclaration)blank ), "volatile int&" ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ public class ASTUtil {
|
|||
|
||||
if(declaration.isConst())
|
||||
type.append("const "); //$NON-NLS-1$
|
||||
if(declaration.isVolatile())
|
||||
type.append("volatile "); //$NON-NLS-1$
|
||||
IASTTypeSpecifier typeSpecifier = declaration.getTypeSpecifier();
|
||||
if(typeSpecifier instanceof IASTElaboratedTypeSpecifier){
|
||||
IASTElaboratedTypeSpecifier elab = (IASTElaboratedTypeSpecifier) typeSpecifier;
|
||||
|
|
Loading…
Add table
Reference in a new issue