Skip to content

Commit

Permalink
Merge pull request #4892 from yebblies/ddmdcomments999
Browse files Browse the repository at this point in the history
[DDMD] Move multi-line comments before the declaration they reference
  • Loading branch information
WalterBright committed Aug 16, 2015
2 parents 8c1b147 + d163e1f commit e9b0ede
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 60 deletions.
32 changes: 19 additions & 13 deletions src/aggregate.h
Expand Up @@ -82,13 +82,14 @@ class AggregateDeclaration : public ScopeDsymbol
Dsymbol *deferred; // any deferred semantic2() or semantic3() symbol
bool isdeprecated; // true if deprecated

Dsymbol *enclosing; /* !=NULL if is nested
* pointing to the dsymbol that directly enclosing it.
* 1. The function that enclosing it (nested struct and class)
* 2. The class that enclosing it (nested class only)
* 3. If enclosing aggregate is template, its enclosing dsymbol.
* See AggregateDeclaraton::makeNested for the details.
*/
/* !=NULL if is nested
* pointing to the dsymbol that directly enclosing it.
* 1. The function that enclosing it (nested struct and class)
* 2. The class that enclosing it (nested class only)
* 3. If enclosing aggregate is template, its enclosing dsymbol.
* See AggregateDeclaraton::makeNested for the details.
*/
Dsymbol *enclosing;
VarDeclaration *vthis; // 'this' parameter if this aggregate is nested
// Special member functions
FuncDeclarations invs; // Array of invariants
Expand All @@ -97,9 +98,12 @@ class AggregateDeclaration : public ScopeDsymbol
DeleteDeclaration *aggDelete; // deallocator

Dsymbol *ctor; // CtorDeclaration or TemplateDeclaration
CtorDeclaration *defaultCtor; // default constructor - should have no arguments, because
// it would be stored in TypeInfo_Class.defaultConstructor
Dsymbol *aliasthis; // forward unresolved lookups to aliasthis

// default constructor - should have no arguments, because
// it would be stored in TypeInfo_Class.defaultConstructor
CtorDeclaration *defaultCtor;

Dsymbol *aliasthis; // forward unresolved lookups to aliasthis
bool noDefaultCtor; // no default construction

FuncDeclarations dtors; // Array of destructors
Expand Down Expand Up @@ -128,7 +132,8 @@ class AggregateDeclaration : public ScopeDsymbol

Prot prot();

Type *handleType() { return type; } // 'this' type
// 'this' type
Type *handleType() { return type; }

// Back end
Symbol *stag; // tag symbol for debug data
Expand Down Expand Up @@ -202,8 +207,9 @@ struct BaseClass

ClassDeclaration *sym;
unsigned offset; // 'this' pointer offset
FuncDeclarations vtbl; // for interfaces: Array of FuncDeclaration's
// making up the vtbl[]
// for interfaces: Array of FuncDeclaration's
// making up the vtbl[]
FuncDeclarations vtbl;

size_t baseInterfaces_dim;
// if BaseClass is an interface, these
Expand Down
7 changes: 4 additions & 3 deletions src/ctfe.h
Expand Up @@ -25,9 +25,10 @@
struct CtfeStatus
{
static int callDepth; // current number of recursive calls
static int stackTraceCallsToSuppress; /* When printing a stack trace,
* suppress this number of calls
*/
/* When printing a stack trace,
* suppress this number of calls
*/
static int stackTraceCallsToSuppress;
static int maxCallDepth; // highest number of recursive calls
static int numArrayAllocs; // Number of allocated arrays
static int numAssignments; // total number of assignments executed
Expand Down
58 changes: 31 additions & 27 deletions src/declaration.h
Expand Up @@ -68,8 +68,9 @@ enum PINLINE;
#define STCtls 0x8000000LL // thread local
#define STCalias 0x10000000LL // alias parameter
#define STCshared 0x20000000LL // accessible from multiple threads
#define STCgshared 0x40000000LL // accessible from multiple threads
// but not typed as "shared"
// accessible from multiple threads
// but not typed as "shared"
#define STCgshared 0x40000000LL
#define STCwild 0x80000000LL // for "wild" type constructor
#define STC_TYPECTOR (STCconst | STCimmutable | STCshared | STCwild)
#define STC_FUNCATTR (STCref | STCnothrow | STCnogc | STCpure | STCproperty | STCsafe | STCtrusted | STCsystem)
Expand Down Expand Up @@ -256,10 +257,10 @@ class VarDeclaration : public Declaration
// When interpreting, these point to the value (NULL if value not determinable)
// The index of this variable on the CTFE stack, -1 if not allocated
int ctfeAdrOnStack;

VarDeclaration *rundtor; // if !NULL, rundtor is tested at runtime to see
// if the destructor should be run. Used to prevent
// dtor calls on postblitted vars
// if !NULL, rundtor is tested at runtime to see
// if the destructor should be run. Used to prevent
// dtor calls on postblitted vars
VarDeclaration *rundtor;
Expression *edtor; // if !=NULL, does the destruction of the variable
IntRange *range; // if !NULL, the variable is known to be within the range

Expand Down Expand Up @@ -523,8 +524,9 @@ class FuncDeclaration : public Declaration
VarDeclaration *vresult; // variable corresponding to outId
LabelDsymbol *returnLabel; // where the return goes

DsymbolTable *localsymtab; // used to prevent symbols in different
// scopes from having the same name
// used to prevent symbols in different
// scopes from having the same name
DsymbolTable *localsymtab;
VarDeclaration *vthis; // 'this' parameter (member and nested)
VarDeclaration *v_arguments; // '_arguments' parameter
Objc_FuncDeclaration objc;
Expand All @@ -546,21 +548,24 @@ class FuncDeclaration : public Declaration
CompiledCtfeFunction *ctfeCode; // Compiled code for interpreter
int inlineNest; // !=0 if nested inline
bool isArrayOp; // true if array operation
bool semantic3Errors; // true if errors in semantic3
// this function's frame ptr
// true if errors in semantic3 this function's frame ptr
bool semantic3Errors;
ForeachStatement *fes; // if foreach body, this is the foreach
bool introducing; // true if 'introducing' function
Type *tintro; // if !=NULL, then this is the type
// of the 'introducing' function
// this one is overriding
// if !=NULL, then this is the type
// of the 'introducing' function
// this one is overriding
Type *tintro;
bool inferRetType; // true if return type is to be inferred
StorageClass storage_class2; // storage class for template onemember's

// Things that should really go into Scope
int hasReturnExp; // 1 if there's a return exp; statement
// 2 if there's a throw statement
// 4 if there's an assert(0)
// 8 if there's inline asm

// 1 if there's a return exp; statement
// 2 if there's a throw statement
// 4 if there's an assert(0)
// 8 if there's inline asm
int hasReturnExp;

// Support for NRVO (named return value optimization)
bool nrvo_can; // true means we can do it
Expand All @@ -571,18 +576,17 @@ class FuncDeclaration : public Declaration

GotoStatements *gotos; // Gotos with forward references

BUILTIN builtin; // set if this is a known, builtin
// function we can evaluate at compile
// time
// set if this is a known, builtin function we can evaluate at compile time
BUILTIN builtin;

int tookAddressOf; // set if someone took the address of
// this function
// set if someone took the address of this function
int tookAddressOf;
bool requiresClosure; // this function needs a closure
VarDeclarations closureVars; // local variables in this function
// which are referenced by nested
// functions
FuncDeclarations siblingCallers; // Sibling nested functions which
// called this one

// local variables in this function which are referenced by nested functions
VarDeclarations closureVars;
// Sibling nested functions which called this one
FuncDeclarations siblingCallers;

unsigned flags; // FUNCFLAGxxxxx

Expand Down
7 changes: 4 additions & 3 deletions src/enum.h
Expand Up @@ -79,9 +79,10 @@ class EnumMember : public Dsymbol
* 3. type id = value
*/
Expression *value;
Expression *origValue; // A cast() is injected to 'value' after semantic(),
// but 'origValue' will preserve the original value,
// or previous value + 1 if none was specified.
// A cast() is injected to 'value' after semantic(),
// but 'origValue' will preserve the original value,
// or previous value + 1 if none was specified.
Expression *origValue;
Type *type;

EnumDeclaration *ed;
Expand Down
3 changes: 1 addition & 2 deletions src/expression.h
Expand Up @@ -457,8 +457,7 @@ class StructLiteralExp : public Expression
{
public:
StructDeclaration *sd; // which aggregate this is for
Expressions *elements; // parallels sd->fields[] with
// NULL entries for fields to skip
Expressions *elements; // parallels sd->fields[] with NULL entries for fields to skip
Type *stype; // final type of result (can be different from sd's type)

Symbol *sinit; // if this is a defaultInitLiteral, this symbol contains the default initializer
Expand Down
17 changes: 10 additions & 7 deletions src/globals.h
Expand Up @@ -63,9 +63,10 @@ struct Param
bool isOpenBSD; // generate code for OpenBSD
bool isSolaris; // generate code for Solaris
bool mscoff; // for Win32: write COFF object files instead of OMF
char useDeprecated; // 0: don't allow use of deprecated features
// 1: silently allow use of deprecated features
// 2: warn about the use of deprecated features
// 0: don't allow use of deprecated features
// 1: silently allow use of deprecated features
// 2: warn about the use of deprecated features
char useDeprecated;
bool useAssert; // generate runtime code for assert()'s
bool useInvariants; // generate class invariant checks
bool useIn; // generate precondition checks
Expand All @@ -77,9 +78,10 @@ struct Param
bool useDIP25; // implement http://wiki.dlang.org/DIP25
bool release; // build release version
bool preservePaths; // true means don't strip path from source file
char warnings; // 0: disable warnings
// 1: warnings as errors
// 2: informational warnings (no errors)
// 0: disable warnings
// 1: warnings as errors
// 2: informational warnings (no errors)
char warnings;
bool pic; // generate position-independent-code for shared libs
bool color; // use ANSI colors in console output
bool cov; // generate code coverage data
Expand Down Expand Up @@ -152,8 +154,9 @@ struct Compiler
};

typedef unsigned structalign_t;
#define STRUCTALIGN_DEFAULT ((structalign_t) ~0) // magic value means "match whatever the underlying C compiler does"
// magic value means "match whatever the underlying C compiler does"
// other values are all powers of 2
#define STRUCTALIGN_DEFAULT ((structalign_t) ~0)

struct Global
{
Expand Down
11 changes: 6 additions & 5 deletions src/module.h
Expand Up @@ -92,9 +92,10 @@ class Module : public Package
Dsymbol *searchCacheSymbol; // cached value of search
int searchCacheFlags; // cached flags

Module *importedFrom; // module from command line we're imported from,
// i.e. a module that will be taken all the
// way to an object file
// module from command line we're imported from,
// i.e. a module that will be taken all the
// way to an object file
Module *importedFrom;

Dsymbols *decldefs; // top level declarations for this Module

Expand Down Expand Up @@ -140,8 +141,8 @@ class Module : public Package
int imports(Module *m);

bool isRoot() { return this->importedFrom == this; }
// true if the module source file is directly
// listed in command line.
// true if the module source file is directly
// listed in command line.
bool isCoreModule(Identifier *ident);

// Back end
Expand Down

0 comments on commit e9b0ede

Please sign in to comment.