[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] FIXED 86868, 95635, 95786
|
FIXED 86868- [Parser] nothing shown
on AST for try/catch outside of function body
FIXED 95635- [GCCBuiltinSymbolProvider]
needs to support additional Other built-in GCC symbols
FIXED 95786- DOM Parser: global operator
delete not found
Devin Steffler
IBM's Eclipse CDT
Ottawa (Palladium), Ontario, Canada
Index: parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java,v
retrieving revision 1.119
diff -u -r1.119 AST2CPPTests.java
--- parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java 19 May 2005 18:59:20 -0000 1.119
+++ parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java 19 May 2005 20:02:53 -0000
@@ -4345,6 +4345,36 @@
assertSame( str, col.getName(9).resolveBinding() );
}
+ public void testBug95786() throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("void f() {\n"); //$NON-NLS-1$
+ buffer.append("char * value;\n"); //$NON-NLS-1$
+ buffer.append("::operator delete(value);\n"); //$NON-NLS-1$
+ buffer.append("}\n"); //$NON-NLS-1$
+
+ IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
+
+ CPPNameCollector col = new CPPNameCollector();
+ tu.accept(col);
+
+ assertFalse( col.getName(2).resolveBinding() instanceof IProblemBinding);
+ }
+
+ public void testBug86868() throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("int foo()\n"); //$NON-NLS-1$
+ buffer.append("try\n"); //$NON-NLS-1$
+ buffer.append("{\n"); //$NON-NLS-1$
+ buffer.append("// function body\n"); //$NON-NLS-1$
+ buffer.append("}\n"); //$NON-NLS-1$
+ buffer.append("catch (...)\n"); //$NON-NLS-1$
+ buffer.append("{\n"); //$NON-NLS-1$
+ buffer.append("}\n"); //$NON-NLS-1$
+
+ IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
+ assertEquals(tu.getDeclarations().length, 1);
+ }
+
public void testBug94779() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append( "void f( int t ){\n" );
Index: parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java,v
retrieving revision 1.2
diff -u -r1.2 GCCCompleteParseExtensionsTest.java
--- parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java 18 May 2005 21:10:11 -0000 1.2
+++ parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java 19 May 2005 20:02:53 -0000
@@ -288,5 +288,88 @@
assertFalse(true);
} catch (Exception e) {}
}
+
+ public void testBug95635() throws Exception{
+ StringWriter writer = new StringWriter();
+ writer.write("void f(){ \n");//$NON-NLS-1$
+ writer.write(" char a[10]; \n"); //$NON-NLS-1$
+ writer.write(" __builtin_va_list b; \n"); //$NON-NLS-1$
+ writer.write(" __builtin_abort(); \n");//$NON-NLS-1$
+ writer.write(" __builtin_exit(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin__Exit(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin__exit(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_conj(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_conjf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_conjl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_creal(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_crealf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_creall(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_cimag(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_cimagf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_cimagl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_imaxabs(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_llabs(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_vscanf(\"\",b);\n");//$NON-NLS-1$
+ writer.write(" __builtin_vsnprintf(a, 1, \"\", b); \n");//$NON-NLS-1$
+ writer.write(" __builtin_vsscanf(\"\", \"\", b);\n");//$NON-NLS-1$
+ writer.write(" __builtin_cosf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_cosl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_expf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_expl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_fabsf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_fabsl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_logf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_logl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sinf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sinl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sqrtf(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sqrtl(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_abs(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_cos(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_exp(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_fabs(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_fprintf((void*)0, \"\");\n");//$NON-NLS-1$
+ writer.write(" __builtin_fputs(\"\", (void*)0);\n");//$NON-NLS-1$
+ writer.write(" __builtin_labs(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_log(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_memcmp((void*)0, (void*)0, 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_memcpy((void*)0,(void*)0, 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_memset((void*)0, 1, 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_printf(\"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_putchar(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_puts(\"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_scanf(\"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sin(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_snprintf(a, 1, \"\");\n");//$NON-NLS-1$
+ writer.write(" __builtin_sprintf(a, \"\");\n");//$NON-NLS-1$
+ writer.write(" __builtin_sqrt(1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_sscanf(\"\", \"\"); \n");//$NON-NLS-1$1
+ writer.write(" __builtin_strcat(a, \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strchr(\"\", 1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strcmp(\"\", \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strcpy(a, \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strcspn(\"\", \"\");\n");//$NON-NLS-1$
+ writer.write(" __builtin_strlen(\"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strncat(a, \"\", 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_strncmp(\"\", \"\", 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_strncpy(a, \"\", 1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_strpbrk(\"\", \"\");\n");//$NON-NLS-1$
+ writer.write(" __builtin_strrchr(\"\", 1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strspn(\"\", \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strstr(\"\", \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_strstr(\"\", \"\"); \n");//$NON-NLS-1$
+ writer.write(" __builtin_vprintf(a, b);\n");//$NON-NLS-1$
+ writer.write(" __builtin_vsprintf(a, 1, \"\", b); \n");//$NON-NLS-1$
+ writer.write(" __builtin_isgreater(1,1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_isgreaterequal(1,1);\n");//$NON-NLS-1$
+ writer.write(" __builtin_isless(1,1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_islessequal(1,1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_islessgreater(1,1); \n");//$NON-NLS-1$
+ writer.write(" __builtin_isunordered(1,1); \n");//$NON-NLS-1$
+ writer.write("} \n"); //$NON-NLS-1$
+
+ parseGCC( writer.toString() );
+ parseGPP( writer.toString() );
+ }
}
Index: parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java,v
retrieving revision 1.1
diff -u -r1.1 GCCBuiltinSymbolProvider.java
--- parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java 17 May 2005 18:40:30 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java 19 May 2005 20:04:42 -0000
@@ -11,7 +11,9 @@
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
+import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTBuiltinSymbolProvider;
+import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
@@ -20,6 +22,8 @@
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
+import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.c.CASTPointer;
@@ -36,7 +40,9 @@
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitTypedef;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPASTPointer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPBasicType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPPointerType;
/**
* This is the IASTBuiltinSymbolProvider used to implement the "Other" built-in GCC symbols defined:
@@ -84,8 +90,80 @@
private static final char[] __BUILTIN_TYPES_COMPATIBLE_P = "__builtin_types_compatible_p".toCharArray(); //$NON-NLS-1$
private static final char[] __BUILTIN_POWI = "__builtin_powi".toCharArray(); //$NON-NLS-1$
private static final char[] __BUILTIN_POWIF = "__builtin_powif".toCharArray(); //$NON-NLS-1$
- private static final char[] __BUILTIN_POWIL = "__builtin_powil".toCharArray(); //$NON-NLS-1$
- private static final int NUM_OTHER_GCC_BUILTINS = 34; // the total number of builtin functions listed above
+ private static final char[] __BUILTIN_POWIL = "__builtin_powil".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ABORT = "__builtin_abort".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXIT1 = "__builtin_exit".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXIT2 = "__builtin__Exit".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXIT3 = "__builtin__exit".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CONJ = "__builtin_conj".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CONJF = "__builtin_conjf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CONJL = "__builtin_conjl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CREAL = "__builtin_creal".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CREALF = "__builtin_crealf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CREALL = "__builtin_creall".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CIMAG = "__builtin_cimag".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CIMAGF = "__builtin_cimagf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_CIMAGL = "__builtin_cimagl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_IMAXABS = "__builtin_imaxabs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_LLABS = "__builtin_llabs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SNPRINTF = "__builtin_snprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_VSCANF = "__builtin_vscanf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_VSNPRINTF = "__builtin_vsnprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_VSSCANF = "__builtin_vsscanf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_COSF = "__builtin_cosf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_COSL = "__builtin_cosl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXPF = "__builtin_expf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXPL = "__builtin_expl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_FABSF = "__builtin_fabsf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_FABSL = "__builtin_fabsl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_LOGF = "__builtin_logf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_LOGL = "__builtin_logl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SINF = "__builtin_sinf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SINL = "__builtin_sinl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SQRTF = "__builtin_sqrtf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SQRTL = "__builtin_sqrtl".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ABS = "__builtin_abs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_COS = "__builtin_cos".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_EXP = "__builtin_exp".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_FABS = "__builtin_fabs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_FPRINTF = "__builtin_fprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_FPUTS = "__builtin_fputs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_LABS = "__builtin_labs".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_LOG = "__builtin_log".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_MEMCMP = "__builtin_memcmp".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_MEMCPY = "__builtin_memcpy".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_MEMSET = "__builtin_memset".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_PRINTF = "__builtin_printf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_PUTCHAR = "__builtin_putchar".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_PUTS = "__builtin_puts".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SCANF = "__builtin_scanf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SIN = "__builtin_sin".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SPRINTF = "__builtin_sprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SQRT = "__builtin_sqrt".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_SSCANF = "__builtin_sscanf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRCAT = "__builtin_strcat".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRCHR = "__builtin_strchr".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRCMP = "__builtin_strcmp".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRCPY = "__builtin_strcpy".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRCSPN = "__builtin_strcspn".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRLEN = "__builtin_strlen".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRNCAT = "__builtin_strncat".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRNCMP = "__builtin_strncmp".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRNCPY = "__builtin_strncpy".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRPBRK = "__builtin_strpbrk".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRRCHR = "__builtin_strrchr".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRSPN = "__builtin_strspn".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_STRSTR = "__builtin_strstr".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_VPRINTF = "__builtin_vprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_VSPRINTF = "__builtin_vsprintf".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISGREATER = "__builtin_isgreater".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISGREATEREQUAL = "__builtin_isgreaterequal".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISLESS = "__builtin_isless".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISLESSEQUAL = "__builtin_islessequal".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISLESSGREATER = "__builtin_islessgreater".toCharArray(); //$NON-NLS-1$
+ private static final char[] __BUILTIN_ISUNORDERED = "__builtin_isunordered".toCharArray(); //$NON-NLS-1$
+
+ private static final int NUM_OTHER_GCC_BUILTINS = 105; // the total number of builtin functions listed above
private IBinding[] bindings=new IBinding[NUM_OTHER_GCC_BUILTINS];
private IScope scope=null;
@@ -107,6 +185,17 @@
__builtin_unsigned_long_long();
__builtin_types_compatible_p();
__builtin_powi();
+ __builtin_exit();
+ __builtin_conj();
+ __builtin_creal_cimag();
+ __builtin_abs();
+ __builtin_printf();
+ __builtin_scanf();
+ __builtin_math();
+ __builtin_put();
+ __builtin_mem();
+ __builtin_str_strn();
+ __builtin_less_greater();
}
private void __builtin_va_list() {
@@ -147,7 +236,7 @@
parms[1] = parms[0];
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
theParms[1] = theParms[0];
temp = new CImplicitFunction(__BUILTIN_EXPECT, scope, functionType, theParms, false);
} else {
@@ -158,7 +247,7 @@
parms[1] = parms[0];
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
theParms[1] = theParms[0];
temp = new CPPImplicitFunction(__BUILTIN_EXPECT, scope, functionType, theParms, false);
}
@@ -183,7 +272,7 @@
((CPointerType)parms[0]).setPointer(new CASTPointer());
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_PREFETCH, scope, functionType, theParms, true);
} else {
IType returnType = new CPPBasicType( IBasicType.t_void, 0 );
@@ -193,7 +282,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_PREFETCH, scope, functionType, theParms, true);
}
@@ -215,7 +304,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_HUGE_VAL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, 0 );
@@ -225,7 +314,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_HUGE_VAL, scope, functionType, theParms, false);
}
@@ -245,7 +334,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_HUGE_VALF, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_float, 0 );
@@ -255,7 +344,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_HUGE_VALF, scope, functionType, theParms, false);
}
@@ -276,7 +365,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_HUGE_VALL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, CPPBasicType.IS_LONG );
@@ -286,7 +375,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_HUGE_VALL, scope, functionType, theParms, false);
}
@@ -309,7 +398,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_INF, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, 0 );
@@ -319,7 +408,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_INF, scope, functionType, theParms, false);
}
@@ -339,7 +428,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_INFF, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_float, 0 );
@@ -349,7 +438,7 @@
parms[0] = parmType;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_INFF, scope, functionType, theParms, false);
}
@@ -370,17 +459,7 @@
parms[0] = new CPointerType(new CQualifierType(parmSds));
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
- temp = new CImplicitFunction(__BUILTIN_INFL, scope, functionType, theParms, false);
- } else {
- IType returnType = new CPPBasicType( IBasicType.t_double, CPPBasicType.IS_LONG );
- IType parmType = new CPPBasicType(IBasicType.t_void, 0);
- IFunctionType functionType = null;
- IType[] parms = new IType[1];
- parms[0] = parmType;
- functionType = new CPPFunctionType(returnType, parms);
- IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_INFL, scope, functionType, theParms, false);
}
@@ -408,7 +487,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NAN, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, 0 );
@@ -417,7 +496,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NAN, scope, functionType, theParms, false);
}
@@ -435,7 +514,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NANF, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_float, 0 );
@@ -444,7 +523,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NANF, scope, functionType, theParms, false);
}
@@ -463,7 +542,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NANL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, CPPBasicType.IS_LONG );
@@ -472,7 +551,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NANL, scope, functionType, theParms, false);
}
@@ -490,7 +569,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NANS, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, 0 );
@@ -499,7 +578,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NANS, scope, functionType, theParms, false);
}
@@ -517,7 +596,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NANSF, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_float, 0 );
@@ -526,7 +605,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NANSF, scope, functionType, theParms, false);
}
@@ -545,7 +624,7 @@
parms[0] = c_const_char_p;
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_NANSL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_double, CPPBasicType.IS_LONG );
@@ -554,7 +633,7 @@
parms[0] = cpp_const_char_p;
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[1];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_NANSL, scope, functionType, theParms, false);
}
@@ -581,14 +660,14 @@
IType[] parms = new IType[1];
parms[0] = c_unsigned_int;
functionType = new CFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_FFS, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_int, 0 );
IType[] parms = new IType[1];
parms[0] = cpp_unsigned_int;
functionType = new CPPFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_FFS, scope, functionType, theParms, false);
}
@@ -660,14 +739,14 @@
IType[] parms = new IType[1];
parms[0] = c_unsigned_long;
functionType = new CFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_FFSL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_int, 0 );
IType[] parms = new IType[1];
parms[0] = cpp_unsigned_long;
functionType = new CPPFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_FFSL, scope, functionType, theParms, false);
}
@@ -739,14 +818,14 @@
IType[] parms = new IType[1];
parms[0] = c_unsigned_long_long;
functionType = new CFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
temp = new CImplicitFunction(__BUILTIN_FFSLL, scope, functionType, theParms, false);
} else {
IType returnType = new CPPBasicType( IBasicType.t_int, 0 );
IType[] parms = new IType[1];
parms[0] = cpp_unsigned_long_long;
functionType = new CPPFunctionType(returnType, parms);
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
temp = new CPPImplicitFunction(__BUILTIN_FFSLL, scope, functionType, theParms, false);
}
@@ -814,7 +893,7 @@
parms[1] = parms[0];
functionType = new CFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
theParms[1] = theParms[0];
temp = new CImplicitFunction(__BUILTIN_TYPES_COMPATIBLE_P, scope, functionType, theParms, true);
} else {
@@ -826,7 +905,7 @@
parms[1] = parms[0];
functionType = new CPPFunctionType(returnType, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
theParms[1] = theParms[0];
temp = new CPPImplicitFunction(__BUILTIN_TYPES_COMPATIBLE_P, scope, functionType, theParms, true);
}
@@ -864,8 +943,8 @@
parms[1] = c_int;
functionType = new CFunctionType(c_double, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
temp = new CImplicitFunction(__BUILTIN_POWI, scope, functionType, theParms, false);
} else {
IType[] parms = new IType[2];
@@ -873,8 +952,8 @@
parms[1] = cpp_int;
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
temp = new CPPImplicitFunction(__BUILTIN_POWI, scope, functionType, theParms, false);
}
@@ -890,8 +969,8 @@
parms[1] = c_int;
functionType = new CFunctionType(c_float, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
temp = new CImplicitFunction(__BUILTIN_POWIF, scope, functionType, theParms, false);
} else {
IType[] parms = new IType[2];
@@ -899,8 +978,8 @@
parms[1] = cpp_int;
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
temp = new CPPImplicitFunction(__BUILTIN_POWIF, scope, functionType, theParms, false);
}
@@ -916,8 +995,8 @@
parms[1] = c_int;
functionType = new CFunctionType(c_long_double, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
temp = new CImplicitFunction(__BUILTIN_POWIL, scope, functionType, theParms, false);
} else {
IType[] parms = new IType[2];
@@ -925,25 +1004,1793 @@
parms[1] = cpp_int;
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
IParameter[] theParms = new IParameter[2];
- theParms[0] = new BuiltinParameter(parms[0]);
- theParms[1] = new BuiltinParameter(parms[1]);
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
temp = new CPPImplicitFunction(__BUILTIN_POWIL, scope, functionType, theParms, false);
}
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
}
-
+
+ public void __builtin_exit() {
+ // void __builtin_abort(void)
+ IBinding temp = null;
+ ICASTSimpleDeclSpecifier voidSds = new CASTSimpleDeclSpecifier();
+ voidSds.setType(IASTSimpleDeclSpecifier.t_void);
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_void);
+ IType c_void = new CBasicType(voidSds);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_void = new CPPBasicType(IBasicType.t_void, 0);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_void;
+ functionType = new CFunctionType(c_void, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_ABORT, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_void;
+ IFunctionType functionType = new CPPFunctionType(cpp_void, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_ABORT, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // void __builtin_exit(int)
+ // void __builtin__Exit(int)
+ // void __builtin__exit(int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_int;
+ functionType = new CFunctionType(c_void, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_EXIT1, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_EXIT2, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_EXIT3, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_void, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_EXIT1, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_EXIT2, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_EXIT3, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+ }
+
+ private void __builtin_conj() {
+ IBinding temp = null;
+ ICASTSimpleDeclSpecifier complexSds = new CASTSimpleDeclSpecifier();
+ complexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ IType c_double_complex = new CBasicType(complexSds);
+ IType cpp_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, 0);
+ IType c_float_complex = c_double_complex;
+ IType cpp_float_complex = cpp_double_complex;
+ ICASTSimpleDeclSpecifier longDoubleComplexSds = new CASTSimpleDeclSpecifier();
+ longDoubleComplexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ longDoubleComplexSds.setLong(true);
+ IType c_long_double_complex = new CBasicType(longDoubleComplexSds);
+ IType cpp_long_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, CPPBasicType.IS_LONG);
+
+ // double complex __builtin_conj(double complex)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_double_complex;
+ functionType = new CFunctionType(c_double_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CONJ, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_double_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CONJ, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // float complex __builtin_conjf(float complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_float_complex;
+ functionType = new CFunctionType(c_float_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CONJF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_float_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_float_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CONJF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long double complex __builtin_conjl(long double complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_double_complex;
+ functionType = new CFunctionType(c_long_double_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CONJL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_double_complex, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CONJL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_creal_cimag() {
+ IBinding temp = null;
+ ICASTSimpleDeclSpecifier complexSds = new CASTSimpleDeclSpecifier();
+ complexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ IType c_double_complex = new CBasicType(complexSds);
+ IType cpp_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, 0);
+ IType c_float_complex = c_double_complex;
+ IType cpp_float_complex = cpp_double_complex;
+ ICASTSimpleDeclSpecifier longDoubleComplexSds = new CASTSimpleDeclSpecifier();
+ longDoubleComplexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ longDoubleComplexSds.setLong(true);
+ IType c_long_double_complex = new CBasicType(longDoubleComplexSds);
+ IType cpp_long_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, CPPBasicType.IS_LONG);
+ ICASTSimpleDeclSpecifier doubleSds = new CASTSimpleDeclSpecifier();
+ doubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ IType c_double = new CBasicType(doubleSds);
+ IType cpp_double = new CPPBasicType(IBasicType.t_double, 0);
+ ICASTSimpleDeclSpecifier floatSds = new CASTSimpleDeclSpecifier();
+ floatSds.setType(IASTSimpleDeclSpecifier.t_float);
+ IType c_float = new CBasicType(doubleSds);
+ IType cpp_float = new CPPBasicType(IBasicType.t_float, 0);
+ ICASTSimpleDeclSpecifier longDoubleSds = new CASTSimpleDeclSpecifier();
+ longDoubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ longDoubleSds.setLong(true);
+ IType c_long_double = new CBasicType(longDoubleSds);
+ IType cpp_long_double = new CPPBasicType(IBasicType.t_double, CPPBasicType.IS_LONG);
+
+ // double __builtin_creal(double complex)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_double_complex;
+ functionType = new CFunctionType(c_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CREAL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CREAL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // float __builtin_crealf(float complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_float_complex;
+ functionType = new CFunctionType(c_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CREALF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_float_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CREALF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long double __builtin_creall(long double complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_double_complex;
+ functionType = new CFunctionType(c_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CREALL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CREALL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // double __builtin_cimag(double complex)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_double_complex;
+ functionType = new CFunctionType(c_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CIMAG, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CIMAG, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // float __builtin_cimagf(float complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_float_complex;
+ functionType = new CFunctionType(c_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CIMAGF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_float_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CIMAGF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long double __builtin_cimagl(long double complex)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_double_complex;
+ functionType = new CFunctionType(c_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_CIMAGL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_double_complex;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_CIMAGL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_abs() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // double
+ ICASTSimpleDeclSpecifier doubleSds = new CASTSimpleDeclSpecifier();
+ doubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ IType c_double = new CBasicType(doubleSds);
+ IType cpp_double = new CPPBasicType(IBasicType.t_double, 0);
+ // long int
+ ICASTSimpleDeclSpecifier longIntSds = new CASTSimpleDeclSpecifier();
+ longIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ longIntSds.setLong(true);
+ IType c_long_int = new CBasicType(longIntSds);
+ IType cpp_long_int = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG);
+ // long double
+ ICASTSimpleDeclSpecifier longDoubleSds = new CASTSimpleDeclSpecifier();
+ longDoubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ longDoubleSds.setLong(true);
+ IType c_long_double = new CBasicType(longDoubleSds);
+ IType cpp_long_double = new CPPBasicType(IBasicType.t_double, CPPBasicType.IS_LONG);
+ // signed long int
+ ICASTSimpleDeclSpecifier signedLongIntSds = new CASTSimpleDeclSpecifier();
+ signedLongIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ signedLongIntSds.setLong(true);
+ signedLongIntSds.setSigned(true);
+ IType c_signed_long_int = new CBasicType(signedLongIntSds);
+ IType cpp_signed_long_int = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_SIGNED);
+ // long long int
+ ICASTSimpleDeclSpecifier longLongIntSds = new CASTSimpleDeclSpecifier();
+ longLongIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ longLongIntSds.setLongLong(true);
+ IType c_long_long_int = new CBasicType(longLongIntSds);
+ IType cpp_long_long_int = new CPPBasicType(IBasicType.t_int, GPPBasicType.IS_LONGLONG);
+ // float
+ ICASTSimpleDeclSpecifier floatSds = new CASTSimpleDeclSpecifier();
+ floatSds.setType(IASTSimpleDeclSpecifier.t_float);
+ IType c_float = new CBasicType(floatSds);
+ IType cpp_float = new CPPBasicType(IBasicType.t_float, 0);
+
+ // int __builtin_abs(int)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_int;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_ABS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_ABS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // double __builtin_fabs(double)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_double;
+ functionType = new CFunctionType(c_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_FABS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_double;
+ IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_FABS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long int __builtin_labs(long int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_int;
+ functionType = new CFunctionType(c_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_LABS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_LABS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // intmax_t __builtin_imaxabs(intmax_t) // C99: 7.18.1.5- intmax_t = signed long int (any signed int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_signed_long_int;
+ functionType = new CFunctionType(c_signed_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_IMAXABS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_signed_long_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_signed_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_IMAXABS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long long int __builtin_llabs(long long int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_long_int;
+ functionType = new CFunctionType(c_long_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_LLABS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_long_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_long_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_LLABS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // float __builtin_fabsf(float)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_float;
+ functionType = new CFunctionType(c_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_FABSF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_FABSF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // long double __builtin_fabsl(long double)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_double;
+ functionType = new CFunctionType(c_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_FABSL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_double;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_FABSL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_printf() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // char * restrict
+ ICASTSimpleDeclSpecifier charPSds = new CASTSimpleDeclSpecifier();
+ charPSds.setType(IASTSimpleDeclSpecifier.t_char);
+ CPointerType c_char_p_r = new CPointerType(new CQualifierType(charPSds));
+ CASTPointer cPointer = new CASTPointer();
+ cPointer.setRestrict(true);
+ c_char_p_r.setPointer(cPointer);
+ GPPASTPointer gppPointer = new GPPASTPointer();
+ gppPointer.setRestrict(true);
+ IType cpp_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), false, false), gppPointer);
+ // const char * restrict
+ ICASTSimpleDeclSpecifier constCharPSds = new CASTSimpleDeclSpecifier();
+ constCharPSds.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds.setConst(true);
+ CPointerType c_const_char_p_r = new CPointerType(new CQualifierType(constCharPSds));
+ CASTPointer cPointerRestrict = new CASTPointer();
+ cPointerRestrict.setRestrict(true);
+ c_const_char_p_r.setPointer(cPointerRestrict);
+ GPPASTPointer gppPointerRestrict = new GPPASTPointer();
+ gppPointerRestrict.setRestrict(true);
+ IType cpp_const_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), true, false), gppPointerRestrict);
+ // void * restrict (FILE)
+ ICASTSimpleDeclSpecifier voidPSds = new CASTSimpleDeclSpecifier();
+ voidPSds.setType(IASTSimpleDeclSpecifier.t_void);
+ CPointerType c_void_p_r = new CPointerType(new CQualifierType(voidPSds));
+ c_void_p_r.setPointer(cPointer);
+ IType cpp_void_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), gppPointer);
+ // va_list // assumed: char * va_list();
+ ICASTSimpleDeclSpecifier vaListSds = new CASTSimpleDeclSpecifier();
+ vaListSds.setType(IASTSimpleDeclSpecifier.t_char);
+ IType type = new CBasicType(vaListSds);
+ CPointerType returnType = new CPointerType(type);
+ returnType.setPointer(new CASTPointer());
+ IFunctionType c_va_list = new CFunctionType(returnType, new IType[0]);
+ IType type2 = new CPPBasicType( IBasicType.t_char, 0 );
+ IType returnType2 = new CPPPointerType(type2);
+ IFunctionType cpp_va_list = new CPPFunctionType(returnType2, new IType[0]);
+ // size_t // assumed: unsigned long int
+ ICASTSimpleDeclSpecifier unsignedLongIntSds = new CASTSimpleDeclSpecifier();
+ unsignedLongIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ unsignedLongIntSds.setLong(true);
+ unsignedLongIntSds.setSigned(true);
+ IType c_size_t = new CBasicType(unsignedLongIntSds);
+ IType cpp_size_t = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_SIGNED);
+
+ // int __builtin_printf(const char * restrict, ...)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_PRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_PRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_sprintf(char * restrict, const char * restrict, ...)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_char_p_r;
+ parms[1] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_SPRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_SPRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_snprintf(char * restrict, size_t, const char * restrict, ...) // use unsigned long int for size_t
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_char_p_r;
+ parms[1] = c_size_t;
+ parms[2] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_SNPRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_size_t;
+ parms[2] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_SNPRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_sprintf(char * restrict, const char * restrict, ...)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_char_p_r;
+ parms[1] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_SPRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_SPRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_fprintf(FILE * restrict, const char * restrict) // use void * restrict for FILE
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_void_p_r;
+ parms[1] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_FPRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_void_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_FPRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_vprintf(const char * restrict, va_list)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p_r;
+ parms[1] = c_va_list;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_VPRINTF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p_r;
+ parms[1] = cpp_va_list;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_VPRINTF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_vsprintf(char * restrict, size_t, const char * restrict, va_list)
+ // int __builtin_vsnprintf(char * restrict, size_t, const char * restrict, va_list)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[4];
+ parms[0] = c_char_p_r;
+ parms[1] = c_size_t;
+ parms[2] = c_const_char_p_r;
+ parms[3] = c_va_list;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[4];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ theParms[3] = new CBuiltinParameter(parms[3]);
+ temp = new CImplicitFunction(__BUILTIN_VSPRINTF, scope, functionType, theParms, true);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_VSNPRINTF, scope, functionType, theParms, true);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ } else {
+ IType[] parms = new IType[4];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_size_t;
+ parms[2] = cpp_const_char_p_r;
+ parms[3] = cpp_va_list;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[4];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ theParms[3] = new CPPBuiltinParameter(parms[3]);
+ temp = new CPPImplicitFunction(__BUILTIN_VSPRINTF, scope, functionType, theParms, true);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_VSNPRINTF, scope, functionType, theParms, true);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+ }
+
+ private void __builtin_scanf() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // const char * restrict
+ ICASTSimpleDeclSpecifier constCharPSds = new CASTSimpleDeclSpecifier();
+ constCharPSds.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds.setConst(true);
+ CPointerType c_const_char_p_r = new CPointerType(new CQualifierType(constCharPSds));
+ CASTPointer cPointer2 = new CASTPointer();
+ cPointer2.setRestrict(true);
+ c_const_char_p_r.setPointer(cPointer2);
+ GPPASTPointer gppPointer2 = new GPPASTPointer();
+ gppPointer2.setRestrict(true);
+ IType cpp_const_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), true, false), gppPointer2);
+ // va_list // assumed: char * va_list();
+ ICASTSimpleDeclSpecifier vaListSds = new CASTSimpleDeclSpecifier();
+ vaListSds.setType(IASTSimpleDeclSpecifier.t_char);
+ IType type = new CBasicType(vaListSds);
+ CPointerType returnType = new CPointerType(type);
+ returnType.setPointer(new CASTPointer());
+ IFunctionType c_va_list = new CFunctionType(returnType, new IType[0]);
+ IType type2 = new CPPBasicType( IBasicType.t_char, 0 );
+ IType returnType2 = new CPPPointerType(type2);
+ IFunctionType cpp_va_list = new CPPFunctionType(returnType2, new IType[0]);
+
+ // int __builtin_vscanf(const char * restrict, va_list)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p_r;
+ parms[1] = c_va_list;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_VSCANF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p_r;
+ parms[1] = cpp_va_list;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_VSCANF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_vsscanf(const char * restrict, const char * restrict, va_list)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_const_char_p_r;
+ parms[1] = c_const_char_p_r;
+ parms[2] = c_va_list;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_VSSCANF, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_const_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ parms[2] = cpp_va_list;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_VSSCANF, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_scanf(const char * restrict, ...)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_SCANF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_SCANF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_sscanf(const char * restrict, const char * restrict, ...)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p_r;
+ parms[1] = c_const_char_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_SSCANF, scope, functionType, theParms, true);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_SSCANF, scope, functionType, theParms, true);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_math() {
+ IBinding temp = null;
+
+ // double
+ ICASTSimpleDeclSpecifier doubleSds = new CASTSimpleDeclSpecifier();
+ doubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ IType c_double = new CBasicType(doubleSds);
+ IType cpp_double = new CPPBasicType(IBasicType.t_double, 0);
+ // long double
+ ICASTSimpleDeclSpecifier longDoubleSds = new CASTSimpleDeclSpecifier();
+ longDoubleSds.setType(IASTSimpleDeclSpecifier.t_double);
+ longDoubleSds.setLong(true);
+ IType c_long_double = new CBasicType(longDoubleSds);
+ IType cpp_long_double = new CPPBasicType(IBasicType.t_double, CPPBasicType.IS_LONG);
+ // float
+ ICASTSimpleDeclSpecifier floatSds = new CASTSimpleDeclSpecifier();
+ floatSds.setType(IASTSimpleDeclSpecifier.t_float);
+ IType c_float = new CBasicType(floatSds);
+ IType cpp_float = new CPPBasicType(IBasicType.t_float, 0);
+
+ // double __builtin_cos(double)
+ // double __builtin_exp(double)
+ // double __builtin_log(double)
+ // double __builtin_sin(double)
+ // double __builtin_sqrt(double)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_double;
+ functionType = new CFunctionType(c_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_COS, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_EXP, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_LOG, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SIN, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SQRT, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_double;
+ IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_COS, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_EXP, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_LOG, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SIN, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SQRT, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ // float __builtin_cosf(float)
+ // float __builtin_expf(float)
+ // float __builtin_logf(float)
+ // float __builtin_sinf(float)
+ // float __builtin_sqrtf(float)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_float;
+ functionType = new CFunctionType(c_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_COSF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_EXPF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_LOGF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SINF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SQRTF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_COSF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_EXPF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_LOGF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SINF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SQRTF, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ // long double __builtin_cosl(long double)
+ // long double __builtin_expl(long double)
+ // long double __builtin_logl(long double)
+ // long double __builtin_sinl(long double)
+ // long double __builtin_sqrtl(long double)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_long_double;
+ functionType = new CFunctionType(c_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_COSL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_EXPL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_LOGL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SINL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CImplicitFunction(__BUILTIN_SQRTL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_long_double;
+ IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_COSL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_EXPL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_LOGL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SINL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ temp = new CPPImplicitFunction(__BUILTIN_SQRTL, scope, functionType, theParms, false);
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+ }
+
+ private void __builtin_put() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // const char *
+ ICASTSimpleDeclSpecifier constCharPSds2 = new CASTSimpleDeclSpecifier();
+ constCharPSds2.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds2.setConst(true);
+ CPointerType c_const_char_p = new CPointerType(new CQualifierType(constCharPSds2));
+ CASTPointer cPointer = new CASTPointer();
+ c_const_char_p.setPointer(cPointer);
+ GPPASTPointer gppPointer = new GPPASTPointer();
+ IType cpp_const_char_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), true, false), gppPointer);
+ // const char * restrict
+ ICASTSimpleDeclSpecifier constCharPSds = new CASTSimpleDeclSpecifier();
+ constCharPSds.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds.setConst(true);
+ CPointerType c_const_char_p_r = new CPointerType(new CQualifierType(constCharPSds));
+ CASTPointer cPointerRestrict = new CASTPointer();
+ cPointerRestrict.setRestrict(true);
+ c_const_char_p_r.setPointer(cPointerRestrict);
+ GPPASTPointer gppPointerRestrict = new GPPASTPointer();
+ gppPointerRestrict.setRestrict(true);
+ IType cpp_const_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), true, false), gppPointerRestrict);
+ // void * restrict (FILE)
+ ICASTSimpleDeclSpecifier voidPSds = new CASTSimpleDeclSpecifier();
+ voidPSds.setType(IASTSimpleDeclSpecifier.t_void);
+ CPointerType c_void_p_r = new CPointerType(new CQualifierType(voidPSds));
+ c_void_p_r.setPointer(cPointerRestrict);
+ IType cpp_void_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), gppPointerRestrict);
+
+ // int __builtin_fputs(const char * restrict, FILE * restrict)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p_r;
+ parms[1] = c_void_p_r;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_FPUTS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p_r;
+ parms[1] = cpp_void_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_FPUTS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_putchar(int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_int;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_PUTCHAR, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_PUTCHAR, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_puts(const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_const_char_p;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_PUTS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_PUTS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_mem() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // void *
+ ICASTSimpleDeclSpecifier voidPSds3 = new CASTSimpleDeclSpecifier();
+ voidPSds3.setType(IASTSimpleDeclSpecifier.t_void);
+ IType c_void_p = new CQualifierType(voidPSds3);
+ IType cpp_void_p = new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false);
+ // const void *
+ ICASTSimpleDeclSpecifier constVoidPSds2 = new CASTSimpleDeclSpecifier();
+ constVoidPSds2.setType(IASTSimpleDeclSpecifier.t_void);
+ constVoidPSds2.setConst(true);
+ CPointerType c_const_void_p = new CPointerType(new CQualifierType(constVoidPSds2));
+ c_const_void_p.setPointer(new CASTPointer());
+ IType cpp_const_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), true, false), new GPPASTPointer());
+ // const void * restrict
+ CASTPointer cPointerRestrict = new CASTPointer();
+ cPointerRestrict.setRestrict(true);
+ GPPASTPointer gppPointerRestrict = new GPPASTPointer();
+ gppPointerRestrict.setRestrict(true);
+
+ ICASTSimpleDeclSpecifier voidPSds = new CASTSimpleDeclSpecifier();
+ voidPSds.setType(IASTSimpleDeclSpecifier.t_void);
+ voidPSds.setConst(true);
+ CPointerType c_const_void_p_r = new CPointerType(new CQualifierType(voidPSds));
+ c_const_void_p_r.setPointer(cPointerRestrict);
+ IType cpp_const_void_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), true, false), gppPointerRestrict);
+ // size_t // assumed: unsigned long int
+ ICASTSimpleDeclSpecifier unsignedLongIntSds = new CASTSimpleDeclSpecifier();
+ unsignedLongIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ unsignedLongIntSds.setLong(true);
+ unsignedLongIntSds.setSigned(true);
+ IType c_size_t = new CBasicType(unsignedLongIntSds);
+ IType cpp_size_t = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_SIGNED);
+
+ // int __builtin_memcmp(const void *, const void *, size_t)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_const_void_p;
+ parms[1] = c_const_void_p;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_MEMCMP, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_const_void_p;
+ parms[1] = cpp_const_void_p;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_MEMCMP, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // void * __builtin_memcpy(void * restrict, const void * restrict, size_t)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_const_void_p_r;
+ parms[1] = c_const_void_p_r;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_void_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_MEMCPY, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_const_void_p_r;
+ parms[1] = cpp_const_void_p_r;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_MEMCPY, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // void * __builtin_memset(void *, int, size_t)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_const_void_p;
+ parms[1] = c_int;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_void_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_MEMSET, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_const_void_p;
+ parms[1] = cpp_int;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_MEMSET, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ private void __builtin_str_strn() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // char *
+ ICASTSimpleDeclSpecifier charPSds3 = new CASTSimpleDeclSpecifier();
+ charPSds3.setType(IASTSimpleDeclSpecifier.t_char);
+ IType c_char_p = new CQualifierType(charPSds3);
+ IType cpp_char_p = new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), false, false);
+ // char * restrict
+ ICASTSimpleDeclSpecifier charPSds2 = new CASTSimpleDeclSpecifier();
+ charPSds2.setType(IASTSimpleDeclSpecifier.t_char);
+ CPointerType c_char_p_r = new CPointerType(new CQualifierType(charPSds2));
+ CASTPointer cPointerRestrict = new CASTPointer();
+ cPointerRestrict.setRestrict(true);
+ GPPASTPointer gppPointerRestrict = new GPPASTPointer();
+ gppPointerRestrict.setRestrict(true);
+ c_char_p_r.setPointer(cPointerRestrict);
+ IType cpp_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), false, false), gppPointerRestrict);
+ // const char *
+ ICASTSimpleDeclSpecifier constCharPSds3 = new CASTSimpleDeclSpecifier();
+ constCharPSds3.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds3.setConst(true);
+ CPointerType c_const_char_p = new CPointerType(new CQualifierType(constCharPSds3));
+ c_const_char_p.setPointer(new CASTPointer());
+ IType cpp_const_char_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), true, false), new GPPASTPointer());
+ // const char * restrict
+ ICASTSimpleDeclSpecifier constCharPSds2 = new CASTSimpleDeclSpecifier();
+ constCharPSds2.setType(IASTSimpleDeclSpecifier.t_char);
+ constCharPSds2.setConst(true);
+ CPointerType c_const_char_p_r = new CPointerType(new CQualifierType(constCharPSds2));
+ c_const_char_p_r.setPointer(cPointerRestrict);
+ IType cpp_const_char_p_r = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_char, 0), true, false), gppPointerRestrict);
+ // size_t // assumed: unsigned long int
+ ICASTSimpleDeclSpecifier unsignedLongIntSds = new CASTSimpleDeclSpecifier();
+ unsignedLongIntSds.setType(IASTSimpleDeclSpecifier.t_int);
+ unsignedLongIntSds.setLong(true);
+ unsignedLongIntSds.setSigned(true);
+ IType c_size_t = new CBasicType(unsignedLongIntSds);
+ IType cpp_size_t = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_SIGNED);
+
+ // char * __builtin_strcat(char * restrict, const char * restrict)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_char_p_r;
+ parms[1] = c_char_p_r;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRCAT, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRCAT, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strchr(const char *, int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_int;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRCHR, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRCHR, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_strcmp(const char *, const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRCMP, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRCMP, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strcpy(char * restrict, const char * restrict)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_char_p_r;
+ parms[1] = c_const_char_p_r;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRCPY, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRCPY, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // size_t __builtin_strcspn(const char *, const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ functionType = new CFunctionType(c_size_t, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRCSPN, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRCSPN, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // size_t __builtin_strlen(const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[1];
+ parms[0] = c_const_char_p;
+ functionType = new CFunctionType(c_size_t, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ temp = new CImplicitFunction(__BUILTIN_STRLEN, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[1];
+ parms[0] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
+ IParameter[] theParms = new IParameter[1];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRLEN, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strpbrk(const char *, const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRPBRK, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRPBRK, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strrchr(const char *, int)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_int;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRRCHR, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_int;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRRCHR, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // size_t __builtin_strspn(const char *, const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ functionType = new CFunctionType(c_size_t, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRSPN, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRSPN, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strstr(const char *, const char *)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_STRSTR, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRSTR, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strncat(char * restrict, const char * restrict, size_t)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_char_p_r;
+ parms[1] = c_const_char_p_r;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_STRNCAT, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRNCAT, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_strncmp(const char *, const char *, size_t)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_const_char_p;
+ parms[1] = c_const_char_p;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_STRNCMP, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_const_char_p;
+ parms[1] = cpp_const_char_p;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRNCMP, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // char * __builtin_strncpy(char * restrict, const char * restrict, size_t)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[3];
+ parms[0] = c_char_p_r;
+ parms[1] = c_const_char_p_r;
+ parms[2] = c_size_t;
+ functionType = new CFunctionType(c_char_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ theParms[2] = new CBuiltinParameter(parms[2]);
+ temp = new CImplicitFunction(__BUILTIN_STRNCPY, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[3];
+ parms[0] = cpp_char_p_r;
+ parms[1] = cpp_const_char_p_r;
+ parms[2] = cpp_size_t;
+ IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
+ IParameter[] theParms = new IParameter[3];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ theParms[2] = new CPPBuiltinParameter(parms[2]);
+ temp = new CPPImplicitFunction(__BUILTIN_STRNCPY, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
+ public void __builtin_less_greater() {
+ IBinding temp = null;
+
+ // int
+ ICASTSimpleDeclSpecifier intSds = new CASTSimpleDeclSpecifier();
+ intSds.setType(IASTSimpleDeclSpecifier.t_int);
+ IType c_int = new CBasicType(intSds);
+ IType cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ // float
+ ICASTSimpleDeclSpecifier floatSds = new CASTSimpleDeclSpecifier();
+ floatSds.setType(IASTSimpleDeclSpecifier.t_float);
+ IType c_float = new CBasicType(floatSds);
+ IType cpp_float = new CPPBasicType(IBasicType.t_float, 0);
+
+ // int __builtin_isgreater(real-floating, real-floating)
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISGREATER, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISGREATER, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_isgreaterequal(real-floating, real-floating)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISGREATEREQUAL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISGREATEREQUAL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_isless(real-floating, real-floating)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISLESS, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISLESS, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_islessequal(real-floating, real-floating)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISLESSEQUAL, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISLESSEQUAL, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_islessgreater(real-floating, real-floating)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISLESSGREATER, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISLESSGREATER, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+
+ // int __builtin_isunordered(real-floating, real-floating)
+ temp = null;
+ if (lang == ParserLanguage.C) {
+ IFunctionType functionType = null;
+ IType[] parms = new IType[2];
+ parms[0] = c_float;
+ parms[1] = c_float;
+ functionType = new CFunctionType(c_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CBuiltinParameter(parms[0]);
+ theParms[1] = new CBuiltinParameter(parms[1]);
+ temp = new CImplicitFunction(__BUILTIN_ISUNORDERED, scope, functionType, theParms, false);
+ } else {
+ IType[] parms = new IType[2];
+ parms[0] = cpp_float;
+ parms[1] = cpp_float;
+ IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
+ IParameter[] theParms = new IParameter[2];
+ theParms[0] = new CPPBuiltinParameter(parms[0]);
+ theParms[1] = new CPPBuiltinParameter(parms[1]);
+ temp = new CPPImplicitFunction(__BUILTIN_ISUNORDERED, scope, functionType, theParms, false);
+ }
+
+ bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
+ }
+
public IBinding[] getBuiltinBindings() {
initialize();
return (IBinding[])ArrayUtil.trim(IBinding.class, bindings);
}
- private class BuiltinParameter implements IParameter {
+ private class CBuiltinParameter implements IParameter {
private static final String BLANK_STRING = ""; //$NON-NLS-1$
private IType type=null;
- public BuiltinParameter(IType type) {
+ public CBuiltinParameter(IType type) {
this.type = type;
}
@@ -995,4 +2842,88 @@
}
}
+
+ private class CPPBuiltinParameter implements ICPPParameter {
+
+ private static final String BLANK_STRING = ""; //$NON-NLS-1$
+ private IType type=null;
+
+ public CPPBuiltinParameter(IType type) {
+ this.type = type;
+ }
+
+ public IType getType() {
+ return type;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isStatic() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isExtern() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isAuto() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isRegister() {
+ return false;
+ }
+
+ public String getName() {
+ return BLANK_STRING;
+ }
+
+ public char[] getNameCharArray() {
+ return BLANK_STRING.toCharArray();
+ }
+
+ /**
+ * returns false
+ */
+ public IScope getScope() {
+ return null;
+ }
+
+ /**
+ * return false
+ */
+ public IASTInitializer getDefaultValue() {
+ return null;
+ }
+
+ /**
+ * return false
+ */
+ public boolean isMutable() throws DOMException {
+ return false;
+ }
+
+ public String[] getQualifiedName() throws DOMException {
+ return new String[0];
+ }
+
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ return new char[0][];
+ }
+
+ public boolean isGloballyQualified() throws DOMException {
+ return true;
+ }
+
+ }
}
Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java,v
retrieving revision 1.24
diff -u -r1.24 CPPASTTranslationUnit.java
--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java 19 May 2005 18:47:41 -0000 1.24
+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java 19 May 2005 20:04:42 -0000
@@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
@@ -31,9 +32,13 @@
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
+import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
@@ -41,8 +46,10 @@
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
@@ -100,10 +107,144 @@
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getScope()
*/
public IScope getScope() {
- if (scope == null)
+ if (scope == null) {
scope = new CPPNamespaceScope(this);
+ addBuiltinOperators(scope);
+ }
+
return scope;
}
+
+ private void addBuiltinOperators(IScope theScope) {
+ // void
+ IType cpp_void = new CPPBasicType(IBasicType.t_void, 0);
+ // void *
+ IType cpp_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), new GPPASTPointer());
+ // size_t // assumed: unsigned long int
+ IType cpp_size_t = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_UNSIGNED);
+
+ // void * operator new (std::size_t);
+ IBinding temp = null;
+ IType[] newParms = new IType[1];
+ newParms[0] = cpp_size_t;
+ IFunctionType newFunctionType = new CPPFunctionType(cpp_void_p, newParms);
+ IParameter[] newTheParms = new IParameter[1];
+ newTheParms[0] = new CPPBuiltinParameter(newParms[0]);
+ temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_NEW, theScope, newFunctionType, newTheParms, false);
+ try {
+ theScope.addBinding(temp);
+ } catch (DOMException de) {}
+
+ // void * operator new[] (std::size_t);
+ temp = null;
+ temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_NEW_ARRAY, theScope, newFunctionType, newTheParms, false);
+ try {
+ theScope.addBinding(temp);
+ } catch (DOMException de) {}
+
+ // void operator delete(void*);
+ temp = null;
+ IType[] deleteParms = new IType[1];
+ deleteParms[0] = cpp_size_t;
+ IFunctionType deleteFunctionType = new CPPFunctionType(cpp_void, deleteParms);
+ IParameter[] deleteTheParms = new IParameter[1];
+ deleteTheParms[0] = new CPPBuiltinParameter(deleteParms[0]);
+ temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_DELETE, theScope, deleteFunctionType, deleteTheParms, false);
+ try {
+ theScope.addBinding(temp);
+ } catch (DOMException de) {}
+
+ // void operator delete[](void*);
+ temp = null;
+ temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_DELETE_ARRAY, theScope, deleteFunctionType, deleteTheParms, false);
+ try {
+ theScope.addBinding(temp);
+ } catch (DOMException de) {}
+ }
+
+ private class CPPBuiltinParameter implements ICPPParameter {
+
+ private static final String BLANK_STRING = ""; //$NON-NLS-1$
+ private IType type=null;
+
+ public CPPBuiltinParameter(IType type) {
+ this.type = type;
+ }
+
+ public IType getType() {
+ return type;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isStatic() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isExtern() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isAuto() {
+ return false;
+ }
+
+ /**
+ * returns false
+ */
+ public boolean isRegister() {
+ return false;
+ }
+
+ public String getName() {
+ return BLANK_STRING;
+ }
+
+ public char[] getNameCharArray() {
+ return BLANK_STRING.toCharArray();
+ }
+
+ /**
+ * returns false
+ */
+ public IScope getScope() {
+ return null;
+ }
+
+ /**
+ * return false
+ */
+ public IASTInitializer getDefaultValue() {
+ return null;
+ }
+
+ /**
+ * return false
+ */
+ public boolean isMutable() throws DOMException {
+ return false;
+ }
+
+ public String[] getQualifiedName() throws DOMException {
+ return new String[0];
+ }
+
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ return new char[0][];
+ }
+
+ public boolean isGloballyQualified() throws DOMException {
+ return true;
+ }
+
+ }
/*
* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java,v
retrieving revision 1.81
diff -u -r1.81 GNUCPPSourceParser.java
--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java 19 May 2005 18:47:41 -0000 1.81
+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java 19 May 2005 20:04:43 -0000
@@ -4359,7 +4359,9 @@
// least
// one of these
}
- while (LT(1) == IToken.t_catch) {
+
+ int nextToken = LT(1);
+ while (nextToken == IToken.t_catch) {
int startOffset = consume(IToken.t_catch).getOffset();
consume(IToken.tLPAREN);
boolean isEllipsis = false;
@@ -4400,6 +4402,14 @@
.setPropertyInParent(ICPPASTCatchHandler.CATCH_BODY);
}
collection.add(handler);
+
+ try {
+ nextToken = LT(1);
+ } catch (EndOfFileException eofe) {
+ // if EOF is reached, then return here and let it be encountered elsewhere
+ // (i.e. try/catch won't be added to the declaration if the exception is thrown here)
+ return;
+ }
}
}
Index: parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java,v
retrieving revision 1.38
diff -u -r1.38 BaseScanner.java
--- parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java 18 May 2005 00:40:10 -0000 1.38
+++ parser/org/eclipse/cdt/internal/core/parser/scanner2/BaseScanner.java 19 May 2005 20:04:44 -0000
@@ -4011,7 +4011,7 @@
argend = skipOverMacroArg();
char[] arg = EMPTY_CHAR_ARRAY;
- int arglen = argend - argstart + 1; // TODO Devin argend shouldn't be 65 it should be 55 for 95119
+ int arglen = argend - argstart + 1;
if (arglen > 0) {
arg = new char[arglen];
System.arraycopy(buffer, argstart, arg, 0, arglen);