Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

DI Generation Improvements #928

Closed
wants to merge 187 commits into from

2 participants

@LightBender

This pull request attempt to improve the automatic generation of DI files by DMD.

All function implementations are removed from DI files except for those inside templates and functions with auto return values.
Proper indenting for DI files.

There were some changes to OutBuffer::write() to fix an OutOfMemory error I was getting on Windows (x64).

If anybody has any questions/comments/rants/raves or finds anything broken let me know. I would love to hear feedback.

NOTE: I apologize in advance for the spurious commits, I was apparently misinformed as to how to properly update my git branch (fetch/merge instead of the proper rebasing).

LightBender and others added some commits
@LightBender LightBender Initial commit for DI generation improvements 4aa8895
@LightBender LightBender Fixed handling of const types 5ceef9f
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ce590c0
@LightBender LightBender All privates now included. Templates class/functions retain implement…
…ation. Immutable variables now keep initializer.
dc6772b
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 52ea71a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b62e855
@LightBender LightBender Fixed bug that would cause immutables inside template function implem…
…entions to lose their initializers.
bb539fe
@LightBender LightBender Fixed bug that would cause manifest constants to lose their initializ…
…ers.
e8f065c
@LightBender LightBender Fixed bug that would cause all function level variables to lose their…
… initializers.
390d2f4
@LightBender LightBender Merge remote-tracking branch 'upstream/master' c92a39c
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 49e7c1f
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 24e7dd1
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 293b46d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 035dbb2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 2767224
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f7faf00
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 4b7f660
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 30ca882
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 15599e9
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b4da79a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 528c456
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d318588
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e2d62a2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 3b8e2f7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 57bfe04
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ea8b2f3
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b85ff89
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1ea04d5
@LightBender LightBender Merge remote-tracking branch 'upstream/master' fcc235a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 848c4a7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 59ec5c6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' cba7380
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 429aa77
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8664080
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ed98a4c
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d7b8065
@LightBender LightBender Initial indent tracking commit, work not finished. a012440
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 17fe8dd
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e2768af
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d0c7a86
@LightBender LightBender Initial indent tracking commit, work not finished. 5d6f9d9
@LightBender LightBender Fixed a merge conflict in statement.c function UnrolledLoopStatement:…
…:toCBuffer
ba922c7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' dd61ab6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8311847
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b69e0de
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 887b425
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e192b34
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 82c2071
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0f31090
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 9416fdd
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b69c06a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 45832cf
@LightBender LightBender Merge remote-tracking branch 'upstream/master' bd3c1e8
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a16dea1
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a78e8ed
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0d8dc6d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f0c77b2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 51626a6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8f2aef8
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e711de4
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 6e46382
@LightBender LightBender Merge remote-tracking branch 'upstream/master' c6fa330
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 40d00de
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 9237ccc
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 98532ed
@LightBender LightBender switched all indenting code to use buf->level 0476a0e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' c7e5cc5
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7c74078
@LightBender LightBender updated to exclude types that non longer need indenting. 2fd2c06
@LightBender LightBender Merge remote-tracking branch 'upstream/master' cc75458
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7a1ca85
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8febdc6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 3d98f2e
@LightBender LightBender testing changes to debug a DMD assert error. 2e25dea
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e39b6ef
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1bbe905
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 995bfe9
@LightBender LightBender Merge remote-tracking branch 'upstream/master' bdf1e5c
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0b21c38
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 2a8ddb2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1c978e7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 127865a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 3f81329
@LightBender LightBender Merge remote-tracking branch 'upstream/master' abeba48
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1acce22
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7a9825e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b9c9020
@LightBender LightBender Merge remote-tracking branch 'upstream/master' becbf13
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 591d005
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ecf3e2a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' af4662b
@LightBender LightBender Merge remote-tracking branch 'upstream/master' fd60d7e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 993371e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 9351cf9
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 54fcb78
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 923ca68
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ff73c40
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 017deee
@LightBender LightBender Merge remote-tracking branch 'upstream/master' cd6107d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a9c6c8f
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 798c188
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0c06fb6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0b439a3
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b62435d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 645791c
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1985a37
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 33ad892
@LightBender LightBender Fixed merge errors with DMD HEAD 36ab5df
@LightBender LightBender Merge remote-tracking branch 'upstream/master' fcf5016
@LightBender LightBender Merge remote-tracking branch 'upstream/master' fb2633e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 154fa60
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 058484b
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0145ef1
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7302ee8
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7147d3d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' fdd2030
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 6ae406d
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 2084998
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 02517d7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' eacaf5f
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d97b4ce
@LightBender LightBender Merge remote-tracking branch 'upstream/master' bf328e4
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 44e96eb
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 474f1fd
@LightBender LightBender Merge remote-tracking branch 'upstream/master' cfa40b3
@LightBender LightBender Merge remote-tracking branch 'upstream/master' dca4387
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 416e528
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a780047
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f7d6baa
@LightBender LightBender Merge remote-tracking branch 'upstream/master' be3fcda
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 2e5ef5c
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 4589790
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d5427a8
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a9b705b
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d6a16cc
@LightBender LightBender Merge remote-tracking branch 'upstream/master' e949ec0
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1609c73
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8be3d56
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 019a960
unknown Merge remote-tracking branch 'upstream/master' 200afe6
unknown Merge remote-tracking branch 'upstream/master' 9be6981
unknown Merge remote-tracking branch 'upstream/master' d4b2996
unknown Merge remote-tracking branch 'upstream/master' 0d82e7e
unknown Merge remote-tracking branch 'upstream/master' b2678de
unknown Merge remote-tracking branch 'upstream/master' 2aa5796
unknown Merge remote-tracking branch 'upstream/master' aa44359
unknown Merge remote-tracking branch 'upstream/master' ea12018
unknown Merge remote-tracking branch 'upstream/master' bc4acb5
unknown Merge remote-tracking branch 'upstream/master' ad3667c
unknown Merge remote-tracking branch 'upstream/master' c931f7e
unknown Merge remote-tracking branch 'upstream/master' 40f7049
unknown Merge remote-tracking branch 'upstream/master' 13be385
unknown Merge remote-tracking branch 'upstream/master' 305f5f4
unknown Merge remote-tracking branch 'upstream/master' a072aed
unknown Updated to account for Issue 7754 5ec8e39
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1c4a55e
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a32b529
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f37f3b2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 9e867ce
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 3549a55
@LightBender LightBender Merge remote-tracking branch 'upstream/master' d08b438
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 69199ec
@LightBender LightBender Merge remote-tracking branch 'upstream/master' de166c2
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0a5dbe7
@LightBender LightBender Fix merge conflict on cond.c 5bc0639
@LightBender LightBender Fixed collisions in class.c and struct.c d4c06b0
@LightBender LightBender Merge remote-tracking branch 'upstream/master' db3bfc8
@LightBender LightBender Merge remote-tracking branch 'upstream/master' cd638be
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b551742
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ecee9ca
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 8c551d6
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 1e7e39a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 0549056
@LightBender LightBender Variables now keep their initializers. Changed assert null check in m…
…type.c at line 5222 to if() null check to fix spurious assert.
0355522
@LightBender LightBender Cleaned up some dead code in prepartion for the pending pull request. 3d23ee1
@LightBender LightBender Replaced tabs with spaces per style requirements. d7aaa69
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 24152fc
@LightBender LightBender Merge remote-tracking branch 'upstream/master' a366de9
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f75f205
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 7f1f7f9
@LightBender LightBender Merge remote-tracking branch 'upstream/master' b93a698
@LightBender LightBender Merge remote-tracking branch 'upstream/master' f26612a
@LightBender LightBender Merge remote-tracking branch 'upstream/master' ede62e7
@LightBender LightBender Merge remote-tracking branch 'upstream/master' 156bb5c
@LightBender LightBender Functions with auto return values must keep their implemenations for DMD
to perform type deduction. (Fixes posix build error)
Fixed delegates in template constraints not keeping their implementions.
(Fixes Windows build error)
2587414
@LightBender LightBender Removed tabs to conform to style guidelines. 35470c0
@LightBender LightBender Removed an extraneous function that was only used for testing. da7cbe9
@9rnsr
Collaborator

I think correct di generation should run AFTER semantic analysis. When it is necessary to keep original code (e.g. template declaration), we can save AST with syntaxCopy before semantic analysis, and use it after.

@9rnsr
Collaborator

I think this pull is terrible. You should create new branch for the pull request, instead of using master. And sometimes you can rebase the branch and push -f to your repo to track dmd head.

@LightBender

Walter put a big comment mars.c about how DI generation should never be done after semantic analysis. I was merely following his advice.

I think what I may have to do close this one and recreate my fork by hand. I was not well instructed in the proper procedures for DMD work when I started this project.

@LightBender

Closing to clean up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
29 src/attrib.c
@@ -26,6 +26,7 @@
#include "module.h"
#include "parse.h"
#include "template.h"
+#include "hdrgen.h"
#if TARGET_NET
#include "frontend.net/pragma.h"
#endif
@@ -348,7 +349,6 @@ void AttribDeclaration::addLocalClass(ClassDeclarations *aclasses)
}
}
-
void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (decl)
@@ -362,13 +362,13 @@ void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
- for (size_t i = 0; i < decl->dim; i++)
+ buf->level++;
+ for (unsigned i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
@@ -868,18 +868,21 @@ void AnonDeclaration::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset
void AnonDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->printf(isunion ? "union" : "struct");
- buf->writestring("\n{\n");
+ buf->writenl();
+ buf->writestring("{");
+ buf->writenl();
+ buf->level++;
if (decl)
{
for (size_t i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- //buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
}
- buf->writestring("}\n");
+ buf->level--;
+ buf->writestring("}");
+ buf->writenl();
}
const char *AnonDeclaration::kind()
@@ -1309,16 +1312,16 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
if (decl)
{
for (size_t i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
}
+ buf->level--;
buf->writeByte('}');
if (elsedecl)
{
@@ -1327,13 +1330,13 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
- for (size_t i = 0; i < elsedecl->dim; i++)
+ buf->level++;
+ for (unsigned i = 0; i < elsedecl->dim; i++)
{
Dsymbol *s = (*elsedecl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
View
5 src/class.c
@@ -26,6 +26,7 @@
#include "module.h"
#include "expression.h"
#include "statement.h"
+#include "hdrgen.h"
/********************************* ClassDeclaration ****************************/
@@ -819,13 +820,13 @@ void ClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writestring("}");
}
else
View
1  src/cond.c
@@ -22,6 +22,7 @@
#include "lexer.h"
#include "mtype.h"
#include "scope.h"
+#include "hdrgen.h"
#include "arraytypes.h"
int findCondition(Strings *ids, Identifier *ident)
View
7 src/declaration.c
@@ -1725,10 +1725,15 @@ void VarDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
/* If changing, be sure and fix CompoundDeclarationStatement::toCBuffer()
* too.
*/
+
+ int ism = 0;
if (type)
+ {
type->toCBuffer(buf, ident, hgs);
+ }
else
- buf->writestring(ident->toChars());
+ buf->writestring(ident->toChars());
+
if (init)
{ buf->writestring(" = ");
#if DMDV2
View
1  src/dsymbol.c
@@ -31,6 +31,7 @@
#include "import.h"
#include "template.h"
#include "attrib.h"
+#include "hdrgen.h"
/****************************** Dsymbol ******************************/
View
4 src/enum.c
@@ -18,6 +18,7 @@
#include "expression.h"
#include "module.h"
#include "declaration.h"
+#include "hdrgen.h"
/********************************* EnumDeclaration ****************************/
@@ -345,16 +346,17 @@ void EnumDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
EnumMember *em = (*members)[i]->isEnumMember();
if (!em)
continue;
- //buf->writestring(" ");
em->toCBuffer(buf, hgs);
buf->writeByte(',');
buf->writenl();
}
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
View
40 src/func.c
@@ -1683,7 +1683,22 @@ void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
StorageClassDeclaration::stcToCBuffer(buf, storage_class);
type->toCBuffer(buf, ident, hgs);
- bodyToCBuffer(buf, hgs);
+ if(hgs->hdrgen == 1)
+ {
+ if(storage_class & STCauto)
+ {
+ hgs->autoMember++;
+ bodyToCBuffer(buf, hgs);
+ hgs->autoMember--;
+ }
+ else if(hgs->tpltMember == 0)
+ buf->writestring(";");
+ else
+ bodyToCBuffer(buf, hgs);
+ }
+ else
+ bodyToCBuffer(buf, hgs);
+ buf->writenl();
}
VarDeclaration *FuncDeclaration::declareThis(Scope *sc, AggregateDeclaration *ad)
@@ -1778,21 +1793,21 @@ int FuncDeclaration::equals(Object *o)
void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- if (fbody &&
- (!hgs->hdrgen || hgs->tpltMember || canInline(1,1,1))
- )
+ if (fbody && (!hgs->hdrgen || hgs->autoMember || hgs->tpltMember))
{ buf->writenl();
// in{}
if (frequire)
- { buf->writestring("in");
+ {
+ buf->writestring("in");
buf->writenl();
frequire->toCBuffer(buf, hgs);
}
// out{}
if (fensure)
- { buf->writestring("out");
+ {
+ buf->writestring("out");
if (outId)
{ buf->writebyte('(');
buf->writestring(outId->toChars());
@@ -1803,18 +1818,22 @@ void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
if (frequire || fensure)
- { buf->writestring("body");
+ {
+ buf->writestring("body");
buf->writenl();
}
buf->writebyte('{');
buf->writenl();
+ buf->level++;
fbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
else
- { buf->writeByte(';');
+ {
+ buf->writeByte(';');
buf->writenl();
}
}
@@ -3305,7 +3324,9 @@ void FuncLiteralDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writestring(kind());
buf->writeByte(' ');
type->toCBuffer(buf, NULL, hgs);
+ hgs->tpltMember++;
bodyToCBuffer(buf, hgs);
+ hgs->tpltMember--;
}
@@ -3711,7 +3732,8 @@ int StaticCtorDeclaration::addPostInvariant()
void StaticCtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (hgs->hdrgen && !hgs->tpltMember)
- { buf->writestring("static this();");
+ {
+ buf->writestring("static this();");
buf->writenl();
return;
}
View
1  src/hdrgen.c
@@ -51,6 +51,7 @@ void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs);
void Module::genhdrfile()
{
OutBuffer hdrbufr;
+ hdrbufr.doindent = 1;
hdrbufr.printf("// D import file generated from '%s'", srcfile->toChars());
hdrbufr.writenl();
View
6 src/hdrgen.h
@@ -22,6 +22,8 @@ struct HdrGenState
int inBinExp;
int inArrExp;
int emitInst;
+ int autoMember; // Non-zero if function is an auto type
+
struct
{
int init;
@@ -29,6 +31,4 @@ struct HdrGenState
} FLinit;
HdrGenState() { memset(this, 0, sizeof(HdrGenState)); }
-};
-
-
+};
View
1  src/init.c
@@ -914,6 +914,7 @@ Expression *ExpInitializer::toExpression()
void ExpInitializer::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
+
exp->toCBuffer(buf, hgs);
}
View
6 src/mtype.c
@@ -1645,7 +1645,7 @@ Type *Type::merge()
//if (next)
//next = next->merge();
- toDecoBuffer(&buf);
+ this->toDecoBuffer(&buf);
sv = stringtable.update((char *)buf.data, buf.offset);
if (sv->ptrvalue)
{ t = (Type *) sv->ptrvalue;
@@ -5219,8 +5219,8 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag)
Parameter::argsToDecoBuffer(buf, parameters);
//if (buf->data[buf->offset - 1] == '@') halt();
buf->writeByte('Z' - varargs); // mark end of arg list
- assert(next);
- next->toDecoBuffer(buf);
+ //assert(next);
+ if(next != NULL) next->toDecoBuffer(buf);
inuse--;
}
View
84 src/root/root.c
@@ -1543,6 +1543,10 @@ OutBuffer::OutBuffer()
data = NULL;
offset = 0;
size = 0;
+
+ doindent = 0;
+ level = 0;
+ linehead = 1;
}
OutBuffer::~OutBuffer()
@@ -1588,7 +1592,33 @@ void OutBuffer::setsize(unsigned size)
void OutBuffer::write(const void *data, unsigned nbytes)
{
- reserve(nbytes);
+ //if (doindent && linehead)
+ //{
+ // if (level)
+ // {
+ // reserve(level);
+ // for (size_t i=0; i<level; i++)
+ // {
+ // this->data[offset] = '\t';
+ // offset++;
+ // }
+ // }
+ // linehead = 0;
+ //}
+ char t = '\t';
+ reserve(nbytes + level);
+ if (doindent && linehead)
+ {
+ if (level)
+ {
+ for (size_t i=0; i<level; i++)
+ {
+ memcpy(this->data + offset, &t, sizeof(t));
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
memcpy(this->data + offset, data, nbytes);
offset += nbytes;
}
@@ -1652,10 +1682,26 @@ void OutBuffer::writenl()
writeByte('\n');
#endif
#endif
+ if (doindent)
+ linehead = 1;
}
void OutBuffer::writeByte(unsigned b)
{
+ if (doindent && linehead
+ && b != '\n')
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(1);
this->data[offset] = (unsigned char)b;
offset++;
@@ -1730,6 +1776,24 @@ void OutBuffer::prependbyte(unsigned b)
void OutBuffer::writeword(unsigned w)
{
+ if (doindent && linehead
+#if _WIN32
+ && w != 0x0A0D)
+#else
+ && w != '\n')
+#endif
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(2);
*(unsigned short *)(this->data + offset) = (unsigned short)w;
offset += 2;
@@ -1755,6 +1819,24 @@ void OutBuffer::writeUTF16(unsigned w)
void OutBuffer::write4(unsigned w)
{
+ if (doindent && linehead
+#if _WIN32
+ && w != 0x000A000D)
+#else
+ )
+#endif
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(4);
*(unsigned *)(this->data + offset) = w;
offset += 4;
View
2  src/root/root.h
@@ -271,6 +271,8 @@ struct OutBuffer : Object
unsigned offset;
unsigned size;
+ int doindent, level, linehead;
+
OutBuffer();
~OutBuffer();
char *extractData();
View
73 src/statement.c
@@ -860,15 +860,16 @@ void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("unrolled {");
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < statements->dim; i++)
- { Statement *s;
-
+ {
+ Statement *s;
s = (*statements)[i];
if (s)
s->toCBuffer(buf, hgs);
}
-
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -1021,10 +1022,13 @@ void ScopeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writeByte('{');
buf->writenl();
+ buf->level++;
if (statement)
+ {
statement->toCBuffer(buf, hgs);
-
+ }
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -1484,7 +1488,9 @@ void ForStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2351,8 +2357,10 @@ void ForeachStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (body)
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2580,8 +2588,10 @@ void ForeachRangeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (body)
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2733,12 +2743,21 @@ void IfStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
condition->toCBuffer(buf, hgs);
buf->writebyte(')');
buf->writenl();
+ if (!ifbody->isScopeStatement())
+ buf->level++;
ifbody->toCBuffer(buf, hgs);
+ if (!ifbody->isScopeStatement())
+ buf->level--;
if (elsebody)
- { buf->writestring("else");
+ {
+ buf->writestring("else");
buf->writenl();
+ if (!elsebody->isScopeStatement())
+ buf->level++;
elsebody->toCBuffer(buf, hgs);
- }
+ if (!elsebody->isScopeStatement())
+ buf->level--;
+ }
}
/******************************** ConditionalStatement ***************************/
@@ -2829,9 +2848,11 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
condition->toCBuffer(buf, hgs);
buf->writenl();
buf->writeByte('{');
+ buf->level++;
buf->writenl();
if (ifbody)
ifbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
if (elsebody)
@@ -2840,7 +2861,9 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
elsebody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -2993,9 +3016,9 @@ void PragmaStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
-
+ buf->level++;
body->toCBuffer(buf, hgs);
-
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -3227,9 +3250,12 @@ void SwitchStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
if (body)
{
if (!body->isScopeStatement())
- { buf->writebyte('{');
+ {
+ buf->writebyte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -3512,7 +3538,8 @@ int DefaultStatement::comeFrom()
void DefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->writestring("default:\n");
+ buf->writestring("default:");
+ buf->writenl();
statement->toCBuffer(buf, hgs);
}
@@ -3546,7 +3573,8 @@ int GotoDefaultStatement::blockExit(bool mustNotThrow)
void GotoDefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->writestring("goto default;\n");
+ buf->writestring("goto default;");
+ buf->writenl();
}
/******************************** GotoCaseStatement ***************************/
@@ -4427,7 +4455,8 @@ void WithStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("with (");
exp->toCBuffer(buf, hgs);
- buf->writestring(")\n");
+ buf->writestring(")");
+ buf->writenl();
if (body)
body->toCBuffer(buf, hgs);
}
@@ -4650,8 +4679,10 @@ void Catch::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (handler)
handler->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -4695,10 +4726,22 @@ Statement *TryFinallyStatement::semantic(Scope *sc)
void TryFinallyStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->printf("try\n{\n");
+ buf->writestring("try");
+ buf->writenl();
+ buf->writebyte('{');
+ buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
- buf->printf("}\nfinally\n{\n");
+ buf->level--;
+ buf->writebyte('}');
+ buf->writenl();
+ buf->writestring("finally");
+ buf->writenl();
+ buf->writebyte('{');
+ buf->writenl();
+ buf->level++;
finalbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -5176,6 +5219,7 @@ int AsmStatement::blockExit(bool mustNotThrow)
void AsmStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("asm { ");
+ buf->level++;
Token *t = tokens;
while (t)
{
@@ -5197,6 +5241,7 @@ void AsmStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
t = t->next;
}
+ buf->level--;
buf->writestring("; }");
buf->writenl();
}
View
5 src/struct.c
@@ -20,6 +20,7 @@
#include "id.h"
#include "statement.h"
#include "template.h"
+#include "hdrgen.h"
FuncDeclaration *StructDeclaration::xerreq; // object.xopEquals
@@ -705,13 +706,13 @@ void StructDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
View
2  src/template.c
@@ -2181,11 +2181,13 @@ void TemplateDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writebyte('}');
buf->writenl();
hgs->tpltMember--;
View
1  src/version.c
@@ -17,6 +17,7 @@
#include "cond.h"
#include "version.h"
#include "module.h"
+#include "hdrgen.h"
/* ================================================== */
View
663 test/compilable/extra-files/header.di
@@ -7,146 +7,147 @@ typedef double mydbl = 10;
int main()
in
{
-assert(1 + (2 + 3) == -(1 - 2 * 3));
+ assert(1 + (2 + 3) == -(1 - 2 * 3));
}
out(result)
{
-assert(result == 0);
+ assert(result == 0);
}
body
{
-float f = (float).infinity;
-int i = cast(int)f;
-writeln((i , 1),2);
-writeln(cast(int)(float).max);
-assert(i == cast(int)(float).max);
-assert(i == -2147483648u);
-return 0;
+ float f = (float).infinity;
+ int i = cast(int)f;
+ writeln((i , 1),2);
+ writeln(cast(int)(float).max);
+ assert(i == cast(int)(float).max);
+ assert(i == -2147483648u);
+ return 0;
}
template Foo(T,int V)
{
-int bar(double d, int x)
-{
-if (d)
-{
-d++;
-}
-else
-d--;
-asm { naked; }
-asm { mov EAX,3; }
-for (;;)
-{
-{
-d = d + 1;
-}
-}
-{
-for (int i = 0;
- i < 10; i++)
-{
-{
-d = i ? d + 1 : 5;
-}
-}
-}
-char[] s;
-foreach (char c; s)
-{
-d *= 2;
-if (d)
-break;
-else
-continue;
-}
-switch (V)
-{
-case 1:
-{
-}
-case 2:
-{
-break;
-}
-case 3:
-{
-goto case 1;
-}
-case 4:
-{
-goto default;
-}
-default:
-{
-d /= 8;
-break;
-}
-}
-enum Label
-{
-A,
-B,
-C,
-}
-;
-void fswitch(Label l)
-{
-final switch (l)
-{
-case A:
-{
-break;
-}
-case B:
-{
-break;
-}
-case C:
-{
-break;
-}
-}
-}
-loop:
-while (x)
-{
-x--;
-if (x)
-break loop;
-else
-continue loop;
-}
-do
-{
-x++;
-}
-while (x < 10);try
-{
-try
-{
-bar(1,2);
-}
-catch(Object o)
-{
-x++;
-}
-}
-finally
-{
-x--;
-}
-Object o;
-synchronized(o) {
-x = ~x;
-}
-synchronized {
-x = x < 3;
-}
-with (o)
-{
-toString();
-}
-}
+ int bar(double d, int x)
+ {
+ if (d)
+ {
+ d++;
+ }
+ else
+ d--;
+ asm { naked; }
+ asm { mov EAX,3; }
+ for (;;)
+ {
+ {
+ d = d + 1;
+ }
+ }
+ {
+ for (int i = 0;
+ i < 10; i++)
+ {
+ {
+ d = i ? d + 1 : 5;
+ }
+ }
+ }
+ char[] s;
+ foreach (char c; s)
+ {
+ d *= 2;
+ if (d)
+ break;
+ else
+ continue;
+ }
+ switch (V)
+ {
+ case 1:
+ {
+ }
+ case 2:
+ {
+ break;
+ }
+ case 3:
+ {
+ goto case 1;
+ }
+ case 4:
+ {
+ goto default;
+ }
+ default:
+ {
+ d /= 8;
+ break;
+ }
+ }
+ enum Label
+ {
+ A,
+ B,
+ C,
+ }
+ ;
+ void fswitch(Label l)
+ {
+ final switch (l)
+ {
+ case A:
+ {
+ break;
+ }
+ case B:
+ {
+ break;
+ }
+ case C:
+ {
+ break;
+ }
+ }
+ }
+ loop:
+ while (x)
+ {
+ x--;
+ if (x)
+ break loop;
+ else
+ continue loop;
+ }
+ do
+ {
+ x++;
+ }
+ while (x < 10);
+ try
+ {
+ try
+ {
+ bar(1,2);
+ }
+ catch(Object o)
+ {
+ x++;
+ }
+ }
+ finally
+ {
+ x--;
+ }
+ Object o;
+ synchronized(o) {
+ x = ~x;
+ }
+ synchronized {
+ x = x < 3;
+ }
+ with (o)
+ {
+ toString();
+ }
+ }
}
static this();
interface iFoo
@@ -157,269 +158,269 @@ class xFoo : iFoo
}
class Foo3
{
- this(int a,...);
- this(int* a)
-{
-}
+ this(int a,...);
+ this(int* a)
+ {
+ }
}
alias int myint;
static notquit = 1;
class Test
{
- void a()
-{
-}
- void b()
-{
-}
- void c()
-{
-}
- void d()
-{
-}
- void e()
-{
-}
- void f()
-{
-}
- void g()
-{
-}
- void h()
-{
-}
- void i()
-{
-}
- void j()
-{
-}
- void k()
-{
-}
- void l()
-{
-}
- void m()
-{
-}
- void n()
-{
-}
- void o()
-{
-}
- void p()
-{
-}
- void q()
-{
-}
- void r()
-{
-}
- void s()
-{
-}
- void t()
-{
-}
- void u()
-{
-}
- void v()
-{
-}
- void w()
-{
-}
- void x()
-{
-}
- void y()
-{
-}
- void z()
-{
-}
- void aa()
-{
-}
- void bb()
-{
-}
- void cc()
-{
-}
- void dd()
-{
-}
- void ee()
-{
-}
- template A(T)
-{
-}
- alias A!(uint) getHUint;
- alias A!(int) getHInt;
- alias A!(float) getHFloat;
- alias A!(ulong) getHUlong;
- alias A!(long) getHLong;
- alias A!(double) getHDouble;
- alias A!(byte) getHByte;
- alias A!(ubyte) getHUbyte;
- alias A!(short) getHShort;
- alias A!(ushort) getHUShort;
- alias A!(real) getHReal;
+ void a()
+ {
+ }
+ void b()
+ {
+ }
+ void c()
+ {
+ }
+ void d()
+ {
+ }
+ void e()
+ {
+ }
+ void f()
+ {
+ }
+ void g()
+ {
+ }
+ void h()
+ {
+ }
+ void i()
+ {
+ }
+ void j()
+ {
+ }
+ void k()
+ {
+ }
+ void l()
+ {
+ }
+ void m()
+ {
+ }
+ void n()
+ {
+ }
+ void o()
+ {
+ }
+ void p()
+ {
+ }
+ void q()
+ {
+ }
+ void r()
+ {
+ }
+ void s()
+ {
+ }
+ void t()
+ {
+ }
+ void u()
+ {
+ }
+ void v()
+ {
+ }
+ void w()
+ {
+ }
+ void x()
+ {
+ }
+ void y()
+ {
+ }
+ void z()
+ {
+ }
+ void aa()
+ {
+ }
+ void bb()
+ {
+ }
+ void cc()
+ {
+ }
+ void dd()
+ {
+ }
+ void ee()
+ {
+ }
+ template A(T)
+ {
+ }
+ alias A!(uint) getHUint;
+ alias A!(int) getHInt;
+ alias A!(float) getHFloat;
+ alias A!(ulong) getHUlong;
+ alias A!(long) getHLong;
+ alias A!(double) getHDouble;
+ alias A!(byte) getHByte;
+ alias A!(ubyte) getHUbyte;
+ alias A!(short) getHShort;
+ alias A!(ushort) getHUShort;
+ alias A!(real) getHReal;
}
template templ(T)
{
-void templ(T val)
-{
-pragma (msg, "Invalid destination type.");
-}
+ void templ(T val)
+ {
+ pragma (msg, "Invalid destination type.");
+ }
}
static char[] charArray = ['"','\''];
class Point
{
- auto x = 10;
- uint y = 20;
+ auto x = 10;
+ uint y = 20;
}
template Foo2(bool bar)
{
-void test()
-{
-static if(bar)
-{
-int i;
-}
-else
-{
-}
+ void test()
+ {
+ static if(bar)
+ {
+ int i;
+ }
+ else
+ {
+ }
-static if(!bar)
-{
-}
-else
-{
-}
+ static if(!bar)
+ {
+ }
+ else
+ {
+ }
-}
+ }
}
template Foo4()
{
-void bar()
-{
-}
+ void bar()
+ {
+ }
}
class Baz4
{
- mixin Foo4!() foo;
- alias foo.bar baz;
+ mixin Foo4!() foo;
+ alias foo.bar baz;
}
template test(T)
{
-int test(T t)
-{
-if (auto o = cast(Object)t)
-return 1;
-return 0;
-}
+ int test(T t)
+ {
+ if (auto o = cast(Object)t)
+ return 1;
+ return 0;
+ }
}
enum x6 = 1;
bool foo6(int a, int b, int c, int d)
{
-return (a < b) != (c < d);
+ return (a < b) != (c < d);
}
auto foo7(int x)
{
-return 5;
+ return 5;
}
class D8
{
}
void func8()
{
-scope a = new D8;
+ scope a = new D8;
}
template func9(T)
{
-T func9()
-{
-T i;
-scope(exit) i = 1;
-scope(success) i = 2;
-scope(failure) i = 3;
-return i;
-}
+ T func9()
+ {
+ T i;
+ scope(exit) i = 1;
+ scope(success) i = 2;
+ scope(failure) i = 3;
+ return i;
+ }
}
template V10(T)
{
-void func()
-{
-{
-for (int i,j = 4; i < 3; i++)
-{
-{
-}
-}
-}
-}
+ void func()
+ {
+ {
+ for (int i,j = 4; i < 3; i++)
+ {
+ {
+ }
+ }
+ }
+ }
}
int foo11(int function() fn)
{
-return fn();
+ return fn();
}
template bar11(T)
{
-int bar11()
-{
-return foo11(function int()
-{
-return 0;
-}
-);
-}
+ int bar11()
+ {
+ return foo11(function int()
+ {
+ return 0;
+ }
+ );
+ }
}
struct S6360
{
- @property const pure nothrow long weeks1()
-{
-return 0;
-}
+ @property const pure nothrow long weeks1()
+ {
+ return 0;
+ }
- const nothrow pure @property long weeks2()
-{
-return 0;
-}
+ const nothrow pure @property long weeks2()
+ {
+ return 0;
+ }
}
struct S12
{
- nothrow this(int n)
-{
-}
- nothrow this(string s)
-{
-}
+ nothrow this(int n)
+ {
+ }
+ nothrow this(string s)
+ {
+ }
}
struct T12
{
- template __ctor()
-{
-immutable this(int args)
-{
-}
-}
- immutable template __ctor(A...)
-{
-this(A args)
-{
-}
-}
+ template __ctor()
+ {
+ immutable this(int args)
+ {
+ }
+ }
+ immutable template __ctor(A...)
+ {
+ this(A args)
+ {
+ }
+ }
}
View
48 test/compilable/extra-files/xheader.di
@@ -12,41 +12,41 @@ class C2;
void foo2(const C2 c);
struct Foo3
{
- int k;
- ~this()
-{
-k = 1;
-}
- this(this)
-{
-k = 2;
-}
+ int k;
+ ~this()
+ {
+ k = 1;
+ }
+ this(this)
+ {
+ k = 2;
+ }
}
class C3
{
- @property int get()
-{
-return 0;
-}
+ @property int get()
+ {
+ return 0;
+ }
}
template foo3(T)
{
-T foo3()
-{
-}
+ T foo3()
+ {
+ }
}
template Foo4(T)
{
-struct Foo4
-{
- T x;
-}
+ struct Foo4
+ {
+ T x;
+ }
}
template C4(T)
{
-class C4
-{
- T x;
-}
+ class C4
+ {
+ T x;
+ }
}
Something went wrong with that request. Please try again.