Commit graph

9 commits

Author SHA1 Message Date
Iain Buclaw
6374bb87b7 Move dmd files into compiler/ 2022-07-09 18:53:07 +02:00
Iain Buclaw
d4506f8b83 test: Test C++ mangling based on C++ runtime, not target platform. 2021-12-11 23:35:20 +00:00
Iain Buclaw
8e5d57628f test: Remove empty TEST_OUTPUT directives
The testsuite complains about any compiler message by default, so these
are redundant.
2021-01-18 08:13:39 +09:00
Geod24
fd8a8244fb Implement extern(C++, "ns") as an AttributeDeclaration
Originally, `extern(C++, ident)` was implemented as introducing a scope,
importing C++ semantics into D, and was made a `ScopeDsymbol`.
Introducing a scope turned out to be a behavior that was problematic,
and users of `extern(C++)` just wanted to use D semantics and have the correct mangling.

Later on, `extern(C++, "namespace")` was implemented, which removed the introduction of a scope.
However, it was implemented within the existing `Nspace`,
basically hacking around the fact that `ScopeDsymbol` introduces a scope
and injecting the symbols in the parent scope.

This commit implements a new AST node, `CPPNamespaceDeclaration`, which is an `AttributeDeclaration`.
`AttributeDeclaration` are the way storage classes (e.g. `extern(C)` and `extern(C++, class|struct)` are implemented,
as well as declarations that apply to a scope without introducing one, such as `DeprecatedDeclaration`.

Since mangling is part of the function's external interface,
CTFE on the message is run during the first semantic pass.
Since `_scope` is set earlier than `semantic` is done on the attribute,
the full `CPPNamespaceDeclaration` needs to be stored in the `Scope`,
not just the resolved `Identifiers`.

Moreover, a few tweaks are required to `cppmangle` to make it work with the new AST structure.
Once the scoped version of `extern(C++, namespace)` is deprecated, the code can be greatly simplified.
2019-06-14 10:30:25 +09:00
Geod24
e8800cd111 Fix issue 19893 - extern(C++ 'ns') should count as module scope
The bug was fixed in the last commit, this just adds the test.
2019-05-30 12:29:31 +09:00
Geod24
6d0e856d1b Fix issue 19920 - Wrong parent for extern(C++, "ns") nested in scope 2019-05-30 12:29:29 +09:00
look-at-me
f13678ed0b Remove phobos dependancy from cppmangle test. 2018-09-21 15:34:50 -04:00
look-at-me
927818e1b1 Fix new C++ mangle syntax producing parent as Nspace. 2018-09-20 20:39:15 -04:00
look-at-me
d9747003d4 Fix Issue 15512 - Implement better C++ name mangling feature. 2018-09-16 18:05:26 -04:00