Mercurial > projects > ldc
comparison dmd/func.c @ 57:a9d29e9f1fed trunk
[svn r61] Added support for D-style variadic functions :)
author | lindquist |
---|---|
date | Thu, 25 Oct 2007 02:39:53 +0200 |
parents | 6fcc08a4d406 |
children | d8dd47ef3973 |
comparison
equal
deleted
inserted
replaced
56:3a784f7790d6 | 57:a9d29e9f1fed |
---|---|
74 nrvo_var = NULL; | 74 nrvo_var = NULL; |
75 shidden = NULL; | 75 shidden = NULL; |
76 llvmQueued = false; | 76 llvmQueued = false; |
77 llvmThisVar = NULL; | 77 llvmThisVar = NULL; |
78 llvmNested = NULL; | 78 llvmNested = NULL; |
79 llvmArguments = NULL; | |
80 llvmArgPtr = NULL; | |
79 } | 81 } |
80 | 82 |
81 Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s) | 83 Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s) |
82 { | 84 { |
83 FuncDeclaration *f; | 85 FuncDeclaration *f; |
1049 a->push(new ExpStatement(0, ie->exp)); | 1051 a->push(new ExpStatement(0, ie->exp)); |
1050 } | 1052 } |
1051 } | 1053 } |
1052 } | 1054 } |
1053 | 1055 |
1056 // we'll handle variadics ourselves | |
1057 #if !IN_LLVM | |
1054 if (argptr) | 1058 if (argptr) |
1055 { // Initialize _argptr to point past non-variadic arg | 1059 { // Initialize _argptr to point past non-variadic arg |
1056 #if IN_GCC | 1060 #if IN_GCC |
1057 // Handled in FuncDeclaration::toObjFile | 1061 // Handled in FuncDeclaration::toObjFile |
1058 v_argptr = argptr; | 1062 v_argptr = argptr; |
1073 offset = (offset + 3) & ~3; // assume stack aligns on 4 | 1077 offset = (offset + 3) & ~3; // assume stack aligns on 4 |
1074 e = new SymOffExp(0, p, offset); | 1078 e = new SymOffExp(0, p, offset); |
1075 e = new AssignExp(0, e1, e); | 1079 e = new AssignExp(0, e1, e); |
1076 e->type = t; | 1080 e->type = t; |
1077 a->push(new ExpStatement(0, e)); | 1081 a->push(new ExpStatement(0, e)); |
1078 #endif | 1082 #endif // IN_GCC |
1079 } | 1083 } |
1080 | 1084 |
1081 if (_arguments) | 1085 if (_arguments) |
1082 { | 1086 { |
1083 /* Advance to elements[] member of TypeInfo_Tuple with: | 1087 /* Advance to elements[] member of TypeInfo_Tuple with: |
1088 Expression *e1 = new VarExp(0, _arguments); | 1092 Expression *e1 = new VarExp(0, _arguments); |
1089 e = new AssignExp(0, e1, e); | 1093 e = new AssignExp(0, e1, e); |
1090 e = e->semantic(sc); | 1094 e = e->semantic(sc); |
1091 a->push(new ExpStatement(0, e)); | 1095 a->push(new ExpStatement(0, e)); |
1092 } | 1096 } |
1097 | |
1098 #endif // !IN_LLVM | |
1093 | 1099 |
1094 // Merge contracts together with body into one compound statement | 1100 // Merge contracts together with body into one compound statement |
1095 | 1101 |
1096 #ifdef _DH | 1102 #ifdef _DH |
1097 if (frequire && global.params.useIn) | 1103 if (frequire && global.params.useIn) |