Christian Kamm
723cfef519
Another shot at fixing the issues with (constant) struct literals and their addresses. See DMD2682, #218 , #324 .
...
The idea is to separate the notion of const from 'this variable can always be
replaced with its initializer' in the frontend. To do that, I introduced
Declaration::isSameAsInitializer, which is overridden in VarDeclaration to
return false for constants that have a struct literal initializer.
So
{{{
const S s = S(5);
void foo() { auto ps = &s; }
// is no longer replaced by
void foo() { auto ps = &(S(5)); }
}}}
To make taking the address of a struct constant with a struct-initializer
outside of function scope possible, I made sure that AddrExp::optimize doesn't
try to run the argument's optimization with WANTinterpret - that'd again
replace the constant with a struct literal temporary.
2009-06-14 19:49:58 +02:00
Frits van Bommel
96fdcd6347
Run semantic3 on imported modules, and emit new symbols with
...
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
2009-06-07 16:00:13 +02:00
Christian Kamm
b4f8bd6e52
Fix #318 by making a list of all seen template instances in a module for
...
singleobj compilation and then making sure they get emitted in their entirety.
2009-06-06 09:47:32 +02:00
Tomas Lindquist Olsen
092381577f
Some minor changes to handling of variables referenced from nested functions in D2 .
...
Added generation of new 'void*[4] reserved;' !ModuleInfo member .
2009-06-03 03:04:47 +02:00
Frits van Bommel
0a8db2289d
Remove redundant null-check in member functions of structs that don't have an
...
invariant.
2009-06-01 01:28:18 +02:00
Christian Kamm
750260070a
Define __C99FEATURES__ in lexer.c for Solaris. Fixes #313 .
2009-05-30 12:47:35 +02:00
Kelly Wilson
a178d9563d
Fix for mingw32 segfault
2009-05-23 14:59:04 -06:00
Christian Kamm
c433604243
Fix bug #307 by doing what DMD does: add the arrayop to
...
sc->module->importedFrom instead of sc->module. That way array ops in template
instantiations will be semantic3'ed.
2009-05-22 10:17:47 +02:00
Christian Kamm
d537ad0d48
Allow package protected members to be accessed by the declaring module even if
...
it isn't in a package.
2009-05-21 18:08:31 +02:00
Christian Kamm
8e56fe69a4
Merged xfBuild patch for dependency tree generation. See #286 .
2009-05-20 21:13:41 +02:00
Frits van Bommel
95c35225bb
Don't print the entire declaration of the alliassee when ->toChars() is
...
called on an `AliasDeclaration`; just printing the name will do. This fixes
#305 , which otherwise tries to generate
{{{
class E {
void A() {
alias /* recurse into E->toCBuffer() */ m;
}
}
}}}
by way of an infinite recursion (causing a segfault when the stack runs out).
2009-05-20 16:20:59 +02:00
Frits van Bommel
81cf30688a
Patch to allow compiling LDC with MinGW, by mp4 / [1]jaffa (slightly edited).
...
Closes #300 .
2009-05-18 14:02:50 +02:00
Frits van Bommel
1ca2ee5d66
Allow ignored pragmas to have a body; don't ignore the body.
...
Also, ignore errors while trying to make sense of parameters to ignored pragmas
for -v.
2009-05-17 23:33:35 +02:00
Tomas Lindquist Olsen
e2ba08388f
Added new FreeBSD and Solaris predefined version identifiers.
2009-05-17 17:10:26 +02:00
Frits van Bommel
76ae0b0ab6
Fix format-string bugs by adding __attribute__((__format__)) in all applicable
...
places and fixing all warnings my gcc produced.
Among other things, this should fix several segfaults (including one I just
ran into).
2009-05-17 00:15:25 +02:00
Frits van Bommel
e7e3632d36
Remove a macro-redefinition warning
2009-05-16 23:00:56 +02:00
Tomas Lindquist Olsen
b87acdc36f
Updated DMDFE version id from 1.042 to 1.045 ...
2009-05-16 22:27:31 +02:00
Tomas Lindquist Olsen
e8780d50e8
Merged DMD 1.045 !!!
2009-05-16 22:21:31 +02:00
Tomas Lindquist Olsen
c0f2af5afd
Added IrTypeFunction and IrTypeDelegate and eliminated IrDType. This means the Type::ir field can be removed. It's the final part needed for the move to a slightly more sane type system. Now the whole thing just needs to be cleaned up :P
...
Added -v-cg switch, which right now just prints "codegen: module.name (module/name.d)" to stdout, this can really help figuring out where, in some complex build command, things go wrong.
2009-05-16 18:19:52 +02:00
Christian Kamm
8c422bde53
Don't always expand aliases to FuncDecls to FuncAliasDecls - breaks for single
...
functions.
2009-05-16 14:22:09 +02:00
Christian Kamm
53c3ac0313
Fix overload resolution issue in dmd bug 313/314 fix.
2009-05-16 12:17:33 +02:00
Tomas Lindquist Olsen
4f59c0cb7b
Removed fix from rev [1331] since rev [1333] adds a more general fix that catches more cases!
2009-05-10 15:50:51 +02:00
Christian Kamm
813c650517
Backport D2 CTFE cast behavior to allow cast(char[])char[n] to succeed.
2009-05-10 15:42:23 +02:00
Tomas Lindquist Olsen
c6dca3fb76
Fixed CTFE evaluation on .dup . Fixes ticket #288 .
2009-05-10 14:32:23 +02:00
Tomas Lindquist Olsen
ecc106d7b7
Fixed dmdfe generated class invariant calls. Also insert proper "this !is null" check before it. Fixed invariant* dstress regressions and generally seems like a good idea. Hope I didn't break anything.. minitests run fine!
2009-05-10 00:46:09 +02:00
Frits van Bommel
5c29832ee7
Fix a bug pointed out by valgrind: OutBuffer::write4() was writing 8 bytes on
...
platforms with 64-bit longs.
2009-05-08 12:21:53 +02:00
Tomas Lindquist Olsen
ca4f588c08
Fixed deal breaker bug for more-at-once compilation when any module contained aggregates. Fixes ticket #272 .
2009-05-07 02:10:29 +02:00
Christian Kamm
9812a8c8ae
Commit workaround for TypeFunction comparing issue.
2009-04-30 23:16:21 +02:00
Frits van Bommel
da4450d2f5
Make sure this still compiles after LLVM r70437, which introduces a
...
specialization for command-line option template parser<char> which does the
wrong thing for us...
2009-04-30 12:25:04 +02:00
Tomas Lindquist Olsen
ca39bb4f4d
Fixed array operation codegen when used from imported templates. All array operations are now emitted with template linkage. Fixed #270 .
2009-04-29 18:59:39 +02:00
Christian Kamm
0485196ae8
Fix parsing of import statements to only pass valid identifiers to Import
...
constructor. Fixes #264 .
2009-04-23 20:44:55 +02:00
Christian Kamm
a38d34dead
Trivial fix for bug #265
2009-04-23 20:28:29 +02:00
Kelly Wilson
d21cdb1df0
Changes for mingw to compile properly
2009-04-22 14:49:49 -06:00
Tomas Lindquist Olsen
1c79df3817
Fixed all issues preventing Tango 0.99.8 to compile with `sh build-tango.sh --verbose ldc'.
2009-04-17 14:38:29 +02:00
Tomas Lindquist Olsen
37cf5a5789
Added Doxygen file.
...
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
2009-04-15 20:06:25 +02:00
Tomas Lindquist Olsen
3d1f8cc565
Merged DMD 1.042.
2009-04-03 17:59:34 +02:00
Tomas Lindquist Olsen
57bf95cb42
Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041.
2009-04-03 17:02:52 +02:00
Frits van Bommel
b7b54b5878
Don't expand tilde ('~') in paths unless it's the first character of the path
...
in question.
This should fix #255 .
2009-04-03 16:35:47 +02:00
Tomas Lindquist Olsen
9c4b2b4036
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
2009-04-03 16:34:11 +02:00
Christian Kamm
8d01068c9b
Apply small includes patch for FreeBSD. Thanks kimelto!
2009-04-02 19:16:44 +02:00
Tomas Lindquist Olsen
c6e9f7f9e2
Moved ir/irtype.* into ir/irdtype.*.
...
Renamed IrType to IrDType, analogous to IrDSymbol.
2009-03-31 20:21:28 +02:00
Frits van Bommel
aa8aad611c
Commit requested by lindquist.
2009-03-31 03:06:19 +02:00
Frits van Bommel
972fca5729
Fix #246 by running type->semantic() on parameters so tuples are expanded.
2009-03-29 23:57:51 +02:00
Christian Kamm
c9b82af9f2
Add newlines to end of file.
2009-03-29 19:19:32 +02:00
Frits van Bommel
e129494812
Allow specific optimization passes to be requested from the command line.
...
Now you can run "`ldc test.d -c -mem2reg -simplifycfg`" if you feel the urge.
The -O<N> options are still supported, and are inserted in the passes list in
the position where they appear on the command line.
(so -simplifycfg -O1 -instcombine does the "right thing")
One small change: -inline is renamed to -enable-inlining due to a naming
conflict with the option to add the -inline pass. -inline now inserts the
inlining pass in the position specified, not in the middle of -O<N>.
(ldmd has been updated to translate -inline to -enable-inlining)
2009-03-29 15:46:55 +02:00
Christian Kamm
f179acda32
Automated merge with http://hg.dsource.org/projects/ldc
2009-03-29 11:44:32 +02:00
Christian Kamm
d7de486493
A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
...
Fixes run/const_15, run/c/const_16_B.
The price is removing the lvalueness of struct literals. If it turns out too
much code depends on this behavior or we don't want to break with DMD, we
could keep struct literals as lvalues and instead convert struct literals used
as expression initializers into struct initializers.
2009-03-29 11:43:45 +02:00
Frits van Bommel
2586278349
This should fix integers below 64 bit on big-endian systems.
2009-03-29 01:29:30 +01:00
Christian Kamm
875a8b25b2
Fix bug in CaseStatement::semantic when there's no enclosing switch.
2009-03-28 21:10:53 +01:00
Christian Kamm
b2e601bd74
Add back some enclosing scope-exit information to the frontend to produce
...
proper error messages inside switch statements.
2009-03-28 14:39:16 +01:00