Commit Graph
62 Commits
Author SHA1 Message Date
David Nadlinger 243146199f Function literals start again at nesting depth zero.
GitHub: Fixes #447.
2013-09-12 13:47:54 +02:00
David Nadlinger e5463f77b7 FuncDeclaration::nestedVars should only be filled in DtoCreateNestedContextType. 2013-09-12 13:46:45 +02:00
David Nadlinger 14bc59f31a Nested context creation code beautification. 2013-09-12 10:14:17 +02:00
kai c28c7fb134 Introduce a debug info builder.
Moves all code from todebug into a new class.
Also caches the compilation unit in order to fix a LLVM 3.4 compile error.
2013-07-29 00:04:08 +02:00
David Nadlinger 9c0514a9b1 Correctly load context for nested class members with own nested context.
Fixes DMD testcase 'xtest46'.
2013-06-14 15:49:15 +02:00
David Nadlinger 292caa1438 Merge the 2.063 frontend. 2013-06-12 20:16:37 +02:00
David Nadlinger 848dee32d4 Store bools as i8.
I really hope we can refactor this to use a less leaky
abstraction later – it should at least be possible to merge
voidToI8 and i1ToI8.
2013-06-07 03:20:54 +02:00
kai 1e4a8fffc2 Remove DMDV1 and DMDV2. 2013-03-06 10:20:24 +01:00
David Nadlinger 0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
David Nadlinger 7a4c378788 Correctly set 'outer' reference of nested inner classes.
Fixes DMD testcase 'test11'.
2013-01-04 16:48:10 +01:00
David Nadlinger 0508acf10b Cleanup: Remove redundant piece of code.
This case is already handled in DtoCreateNestedContextType.
2013-01-04 07:31:18 +01:00
David Nadlinger 0cd78dd579 Cleanup: Clang warning fixes.
No warnings left on a '-Wall' build except for a single tautological
compare in gen/asm-x86-32.h, which indeed seems like a bug.
2012-12-20 01:00:55 +01:00
David Nadlinger db59b30eda Slight rewrite to make intent cleaner.
No functionality change intended, although it might make the last
commit unnecessary.
2012-12-19 20:38:54 +01:00
David Nadlinger 080d0cef0f Debug log formatting fix. 2012-12-19 19:49:03 +01:00
David Nadlinger 9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
David Nadlinger 45a3060da7 Prettied up nested context debug output.
The assertion is currently triggered when building the Tango/D1 unit tests.
2012-11-08 21:44:14 +01:00
David Nadlinger ece5176aa9 D1: Fix Tango build.
'this' for methods nested in structs is now internally passed as a
pointer, even if struct this is by value in D1.
2012-10-21 01:11:04 +02:00
David Nadlinger 051cd7302e Fixed two issues with nested functions as template alias parameters.
Fixes #131 (GitHub).
2012-10-07 03:06:07 +02:00
David Nadlinger c9e2fc34d1 Cleanup.
If ad would be null, the code above would have already crashed.
2012-10-06 20:40:14 +02:00
David Nadlinger 2d54a02295 Use null instead of undef for unneeded nested context pointers. 2012-10-06 13:07:17 +02:00
David Nadlinger d4eafe53e0 Removed obsolete nested context styles.
NChybrid was the only one that didn't instantly trigger a "not
implemented" assertion on any code using nested function for a long
time, and removing the cruft greatly improves code readability
(maintainability is a moot point anyway given its current state).
2012-09-07 03:51:33 +02:00
David Nadlinger ee4285f934 Properly handle DMD-internal "reference variables".
Previously, we just had a hack to make ref foreach statements work.
This commit enables them to work in other cases as well, like the
implicit __result variable for functions with out-contracts (which
is such a magic ref variable for ref-returning functions).

Fixes DMD testcase 'testcontracts'.
2012-09-07 03:51:33 +02:00
kai 2dbee75523 Prefer C++-style casts.
This is based on Item 2 of "More Effective C++". In general, the C++ cast operators are more expressive and easy to find,
e.g. by grep. Using const_cast also shuts up some compiler warnings.
2012-08-02 19:55:29 +02:00
David Nadlinger cef19fb225 Fix #125 – Nested class context pointer invalid (D1).
Patch originally by Alexey Prokhin, thanks.
2012-06-24 16:18:47 +02:00
David Nadlinger 67f12fe8b5 Fixed DSource #330 – Many-at-a-time nested context crash (D1). 2012-06-24 11:30:32 +02:00
David Nadlinger 61e61e47f0 Fix #125 - fix generation of nested context chains.
Just declaring the type of the parent is obviously not enoguh, we need to have run this very code for determining level and context type (if the parent is also nested, that is).
2012-06-23 17:05:59 +02:00
Alexey Prokhin 15a903580b Partial fix for #69 — LDC1 from master fails to build Tango.
Fixed regression that has been introduced in commit 9889067.
2012-01-29 12:32:13 +04:00
Alexey Prokhin 9889067420 Fixed #53 — Assertion !isaStruct(t) 2012-01-10 19:46:32 +04:00
Alexey Prokhin 91f4e5d015 Added emission of dwarf lexical blocks.
Also, dropped support for DISABLE_DEBUG_INFO definition.
2011-12-04 15:34:35 +04:00
Alexey Prokhin b8721a8515 Emit debug info for variables that are used in nested functions 2011-12-03 23:45:58 +04:00
Alexey Prokhin 629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
David Nadlinger 9864129fb8 Merge branch 'master' into merge-2.054
Conflicts:
	gen/statements.cpp (returning void from main() was fixed on both branches)
2011-08-17 16:09:28 +02:00
David Nadlinger 3f448afa37 Another nested context crash fix.
The test case that would previously crash:

a.d
---
module a;

@property bool empty(T)(in T[] a) {
  return !a.length;
}

void find(alias pred,R1)(R1 haystack) {
  simpleMindedFind!pred(haystack);
}

void simpleMindedFind(alias pred, R1)(R1 haystack) {
  bool haystackTooShort() {
    return haystack.empty;
  }
}
---

b.d
---
module b;

import c;

void getTimeZone() {
  indexOf();
}
---

c.d
---
module c;

import a;

void indexOf()() {
  find!({})("");
}
---
2011-08-17 02:33:33 +02:00
David Nadlinger 618051022f Fixed crash in DtoCreateNestedContextType().
In some cases, like the following, DtoDeclareFunction() hasn't already been called when DtoCreateNestedContextType() is invoked. This seems to have been anticipated when the function was originally written, but DtoDeclareFunction() was previously called after the ir func was already accessed in fd->ir.irFunc->nestedContextCreated.

---
void main() {
  mixin({
    string foo() {
      return "";
    }

    string bar()() {
      return foo();
    }

    return bar();
  }());
}
---
2011-07-28 23:17:20 +02:00
David Nadlinger 7a24e12736 Cleanup: Remove unused code in backend, silence some warnings.
This removed quite some clutter that has presumably piled up because LDC is seldom built with a lot of warnings enabled due to DMDFE.
2011-04-24 12:21:33 +02:00
David Nadlinger 8f5f93057c Changed DtoResolveNestedContext() return type to void – it didn't even have a return statement! 2011-04-24 11:39:53 +02:00
Kelly Wilson 72ea043124 Recommit klickverbot's patch for LLVM-2.9. 2011-04-20 09:28:37 -06:00
Kelly Wilson 7c81278b9c Backed out changeset 5253bfbb3890 2011-04-20 00:28:23 -06:00
Kelly Wilson b26b0f4196 Upgrade to LLVM-2.9. Thanks to David Nadlinger for the patch. 2011-04-19 21:57:15 -06:00
Alexey Prokhin 70aee84c70 Fix passing of a padded struct to a function 2011-02-26 20:16:01 +03:00
Alexey Prokhin 21659b6a5d Check in DtoNestedVariable() whether the needed frame can be accessed 2011-01-04 19:06:25 +03:00
Alexey Prokhin e7c880cd08 Store the right context frame in nested structs and classes. 2010-12-19 12:13:00 +03:00
Alexey Prokhin 71f653f19b Fixes for closures 2010-12-15 17:05:16 +03:00
Alexey Prokhin 3eb6b5e8c8 Fixed a crash when compiling test runnable/A16. 2010-12-14 14:35:52 +03:00
Alexey Prokhin 59d1ec5e0b Another fix for nested context in structs. 2010-11-05 11:55:23 +03:00
Alexey Prokhin 360a99caa9 Resolving nested context for structs.
* * *
Another fix for nested structs
* * *
Yet another fix for nested structs
2010-11-02 13:21:36 +03:00
Alexey Prokhin e4c3179d43 Different fixes: phobos compiles now 2010-10-28 14:53:01 +04:00
Alexey Prokhin b1e5993873 Started work on phobos 2010-10-27 18:13:46 +04:00
Benjamin Kramer 977fa551ee Push the context through StructType::get.
Requires LLVM >= 78258. Also remove old #if's.
2009-08-06 01:47:39 +02:00
Frits van Bommel 060d18b91e Fix a bug in DtoNestedInit and update an unrelated comment. 2009-06-03 12:32:35 +02:00