mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 98520
This commit is contained in:
parent
08eb1c00e5
commit
dd8c9f0af7
3 changed files with 34 additions and 29 deletions
|
@ -10,11 +10,43 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dsteffle
|
* @author dsteffle
|
||||||
*/
|
*/
|
||||||
public class AST2CSpecFailingTest extends AST2SpecBaseTest {
|
public class AST2CSpecFailingTest extends AST2SpecBaseTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
[--Start Example(C 6.7.7-6):
|
||||||
|
typedef signed int t;
|
||||||
|
typedef int plain;
|
||||||
|
struct tag {
|
||||||
|
unsigned t:4;
|
||||||
|
const t:5;
|
||||||
|
plain r:5;
|
||||||
|
};
|
||||||
|
t f(t (t));
|
||||||
|
long t;
|
||||||
|
--End Example]
|
||||||
|
*/
|
||||||
|
public void test6_7_7s6() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("typedef signed int t;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("typedef int plain;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct tag {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("unsigned t:4;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("const t:5;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("plain r:5;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("t f(t (t));\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("long t;\n"); //$NON-NLS-1$
|
||||||
|
try {
|
||||||
|
parse(buffer.toString(), ParserLanguage.C, true, 0);
|
||||||
|
assertTrue(false);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[--Start Example(C 6.10.3.5-6):
|
[--Start Example(C 6.10.3.5-6):
|
||||||
#define str(s) # s
|
#define str(s) # s
|
||||||
|
|
|
@ -1254,33 +1254,6 @@ public class AST2CSpecTest extends AST2SpecBaseTest {
|
||||||
parseCandCPP(buffer.toString(), true, 0);
|
parseCandCPP(buffer.toString(), true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
[--Start Example(C 6.7.7-6):
|
|
||||||
typedef signed int t;
|
|
||||||
typedef int plain;
|
|
||||||
struct tag {
|
|
||||||
unsigned t:4;
|
|
||||||
const t:5;
|
|
||||||
plain r:5;
|
|
||||||
};
|
|
||||||
t f(t (t));
|
|
||||||
long t;
|
|
||||||
--End Example]
|
|
||||||
*/
|
|
||||||
public void test6_7_7s6() throws Exception {
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
|
||||||
buffer.append("typedef signed int t;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("typedef int plain;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("struct tag {\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("unsigned t:4;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("const t:5;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("plain r:5;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("t f(t (t));\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("long t;\n"); //$NON-NLS-1$
|
|
||||||
parse(buffer.toString(), ParserLanguage.C, true, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[--Start Example(C 6.7.7-7):
|
[--Start Example(C 6.7.7-7):
|
||||||
typedef void fv(int), (*pfv)(int);
|
typedef void fv(int), (*pfv)(int);
|
||||||
|
|
|
@ -1076,9 +1076,9 @@ public class CVisitor {
|
||||||
IASTNode parent = node.getParent();
|
IASTNode parent = node.getParent();
|
||||||
if( parent instanceof IASTStandardFunctionDeclarator ){
|
if( parent instanceof IASTStandardFunctionDeclarator ){
|
||||||
parent = ((IASTDeclarator)parent).getParent();
|
parent = ((IASTDeclarator)parent).getParent();
|
||||||
if ( parent instanceof IASTFunctionDefinition ) {
|
if ( parent instanceof IASTFunctionDefinition )
|
||||||
return ((IASTCompoundStatement)((IASTFunctionDefinition)parent).getBody()).getScope();
|
return ((IASTCompoundStatement)((IASTFunctionDefinition)parent).getBody()).getScope();
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( node instanceof IASTEnumerator ){
|
else if( node instanceof IASTEnumerator ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue