Commit graph

100 commits

Author SHA1 Message Date
David Nadlinger
b47aee1750 refactor: Remove last bits of direct connection between DVarValue and VarDeclaration
The relationship between them is at best tenuous; DVarValue should
probably be renamed to DLValue and is used right now to describe
a general lvalue, of which variables are just one example.
2016-03-29 09:08:55 +01:00
David Nadlinger
e127150cda Always use null for unneeded context pointers
This fixes the 'object' unit tests in 2.070.
2016-02-25 20:08:10 +01:00
Martin
ddfaac10b3 Rename DtoAggrCopy/ZeroInit() to DtoMemCpy/SetZero() overloads
And replace some obvious load->store combos by a memcpy.
2015-12-04 22:23:09 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
b63a5e3cf8 Merge branch 'master' into merge-2.068 2015-10-22 22:39:46 +02:00
Martin
93158caca8 Respect alignments of captured variables when building nested context LL struct 2015-10-18 23:25:37 +02:00
Kai Nacke
012a9ee05c Merge branch 'master' into merge-2.068 2015-10-10 17:49:03 +02:00
Kai Nacke
0040b01675 Fix warning because of signed/unsigned comparison 2015-10-09 23:39:28 +02:00
Martin
46421dbd5f Proper (?) fix in getParentFunc() 2015-10-08 19:41:16 +02:00
Martin
b0649397c0 Nested static functions and function literals do not inherit the parent context 2015-10-08 19:40:54 +02:00
Martin
0d7c0aeedc Proper (?) fix in getParentFunc() 2015-10-08 03:23:02 +02:00
Martin
a2fe91d5e3 Nested static functions and function literals do not inherit the parent context 2015-10-08 02:17:58 +02:00
Martin
cda8a12112 Merge branch 'master' into merge-2.068
Conflicts:
	dmd2/root/man.c
	tests/d2/dmd-testsuite
2015-10-05 22:56:36 +02:00
Martin
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02:00
Martin
8ee0e250c7 Merge branch 'master' into merge-2.068 2015-10-02 15:38:02 +02:00
Martin
aec8208c00 Fix debug infos of nested variables 2015-10-01 00:14:38 +02:00
David Nadlinger
4cc492b1df nested: Fix over-zealous invalid frame access check for calling context "root" functions 2015-09-26 15:24:36 +02:00
David Nadlinger
ce66fa4866 Emit error on invalid nested function call instead of crashing
For fail_compilation/fail39.d, the frontend furthermore passes a
FuncExp with a TOKdelegate declaration, but a function pointer type
to the glue layer. Just add that to the special case list.
2015-09-26 15:24:36 +02:00
David Nadlinger
ee50259dfd C ABI: Do not pass empty structs as parameters at all
This is most visible on x86 (32-bit), where the stack
alignment is off otherwise.

This change is quite messy because many places assumed
that there was always exactly one LLVM parameter per
TypeFunction::parameters entry.
2015-08-22 23:41:56 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +02:00
Kai Nacke
15b1ee1576 DebugInfo: Output the underlying delegate for lazy parameters.
This fixes issue #959.
2015-06-04 15:09:29 +02:00
kai
b3e239a527 Fix generation of DWARF debug information in LLVM 3.6.
The creation of complex expressions (e.g. address calculations) was extended in LLVM 3.6.
2014-10-12 12:40:31 +02:00
David Nadlinger
bff766b379 Track member field index in IrTypeAggr, not IrField.
This fixes a regression introduced in caa2f15c8a. The IrDsymbol
metadata is obviously reset in between modules, while IrTypes
are not. Thus, we can never set symbol metadata when resolving
types, as the symbol data will be wrong in all modules following
the one where the type was first resolved.

GitHub: Fixes #739.
2014-10-11 03:28:49 +02:00
Alexey Prokhin
18f33b1815 Make IrDsymbol to be a typesafe union to reduce memory usage 2014-09-12 14:43:49 +04:00
kai
45fca1f3b5 Add line number to error message of -nogc switch.
This was suggested by bearophile in the news group.
It also changes all Loc objects to be passed by reference.
2014-07-04 07:15:05 +02:00
kai
2b6dbb03f4 Add IF_LOG to more logging statements.
Evaluating arguments which call toChars() or toPrettyChars() are much more expensive then checking Logger::enabled().
2014-06-26 06:54:38 +02:00
David Nadlinger
b40969b660 Re-introduce glue layer closure building error.
This reverts part of b15ffe2ef0,
and fixes 'fail_compilation/fail10666'.
2014-06-04 14:34:28 +02:00
kai
b15ffe2ef0 Merge branch 'master' into merge-2.064
Conflicts:
	gen/nested.cpp
2014-06-02 06:41:23 +02:00
Christian Kamm
522585aa6d Fix dmd test template2962 by removing nestedVars.
nestedVars was always a copy of closureVars. There was no point to it
existing.
2014-05-29 16:49:43 +02:00
Alexey Prokhin
a6973a39b7 Temporary variables cannot be referenced inside a closure 2014-01-12 15:44:17 +04:00
kai
6287a4d422 Replace ArrayIter<> with Array<>::iterator.
Just use the new iterator instead of the old Java-like class.
Also removes a dead iterator and replaces an iterator with a
pointer in some place.
2014-01-11 14:48:41 +01:00
Kai Nacke
bdc1f44088 Merge remote-tracking branch 'origin/master' into merge-2.064
Conflicts:
	gen/runtime.cpp
	runtime/CMakeLists.txt
2013-12-08 19:29:10 +01:00
Kai Nacke
aeba90b9f9 Fix a clang warning 2013-12-08 18:59:17 +01:00
Alexey Prokhin
5a10a23cef Remove redundant FuncDeclaration::nestedVars.
The change not only makes the code cleaner but also fixes compilation of multiple files at once.
Previously, fd->nestedVars may have been filled twice if fd was a template function instantiated in two modules simultaneously.
2013-12-08 14:37:15 +04:00
David Nadlinger
265d3ee069 Do not try to emit nested functions with unanalyzed parents.
GitHub: Fixes #497.
2013-10-13 21:37:53 +02:00
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