Skip to content

Commit 3d7a1a0

Browse files
committed
Merge pull request #40 from rainers/master
Visual D 0.3.41 beta2
2 parents a6de3cf + 0837b24 commit 3d7a1a0

File tree

13 files changed

+526
-186
lines changed

13 files changed

+526
-186
lines changed

CHANGES

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,23 @@ unreleased Version 0.3.41
704704
- module list now shows x64 addresses correctly
705705
- verboser output for DLL load/unload
706706
- implement "set next statement"
707-
- callstack: parameter list alo showed locals
707+
- callstack: parameter list also showed locals
708708
- disassembly: show symbols, address labels
709709
- fix dstring display
710+
- can list associative array members (needs
711+
https://github.com/D-Programming-Language/dmd/pull/4473 for Win64)
712+
- show exception number for Win32 exceptions
713+
- can now load PDB symbols from Microsoft Symbol Server or local
714+
cache folders
715+
- now support lexical scope blocks (helps C++ and D with
716+
https://github.com/D-Programming-Language/dmd/pull/2867)
710717
* cv2pdb:
711718
- improvements for DWARF conversion
712-
* dparser updated to c89aa45334b8c768559bc243da73b87c518a9a58 with support for new
719+
* dparser updated to cf26dbe426b10957f6364313cc7121e41083bebe with support for new
713720
language features in dmd 2.067
721+
* some initial support for finding symbol references
722+
* new linker option "build and use local phobos library" to get a COFF32 version (dmd 2.067+)
723+
or add missing debug info (dmd 2.065+)
724+
* renaming project configuration did not change respective config on all platforms
725+
* workaround for link response file with spaces, but disabled short names on NTFS volume
726+
* profiler window: non-D symbols (e.g. C++ mangled functions) are no longer displayed empty

TODO

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ Debugger:
124124
---------------
125125
Any/dmd:
126126
- stepping through function call jumps to default assignment
127+
- bad line info for scope(exit), for increment expression, constants
127128
- arguments to local functions treated as locals
128129
- local functions/delegates should have debug info for closure vars ("this" exists)
129130
- extern(D) function arguments shown in the wrong order
130131
- support GDC+mago
131-
- bugzilla 14286: x64: no type information for dAssocArray
132+
+ bugzilla 14286: x64: no type information for dAssocArray
132133
- bugzilla 4014: no debug info from libraries
133134

135+
134136
Mago:
135137
- show derived class
136138
- step after exception
@@ -150,14 +152,15 @@ Mago:
150152
- identically named locals show the same value
151153
+ dstring shows as uint[] without string representation
152154
- string/wstring shown as char/wchar[], but with correct string representation
153-
- AA indexing
154-
- AA preview/expand
155+
+ AA indexing
156+
+ AA preview/expand
155157
- Array preview
156158
- delegate value/type
157159
- struct preview
158160
+ verboser output when loading/unloading DLLs
159161
- attach to process
160162
- hardware breakpoints
163+
+ does not work with variable scope
161164

162165
VS:
163166
- VS2012: autoexp.dat does not work? depends on debug engine => edit and continue
@@ -200,7 +203,7 @@ Unsorted
200203
- configuration of dependent project not read from configuration manager
201204
+ jump to assertion error
202205
+ import std.container: jump to package
203-
- renaming configuration does not change project config
206+
+ renaming configuration does not change project config
204207
+ win32coff support
205208
- file search: replace . with \ in path search?
206209
+ run cv2pdb disabled for GDC/x64

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#define VERSION_MINOR 3
33
#define VERSION_REVISION 41
44
#define VERSION_BETA -beta
5-
#define VERSION_BUILD 1
5+
#define VERSION_BUILD 2

doc/CppConversion.dd

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class C {
103103
static int x;
104104
DECL *foo(int flags = 0);
105105
};
106+
int C::x = 3;
107+
// moved with the implementation
108+
DECL *C::foo(int flags) { return NULL; }
106109
,
107110
struct C {
108111
// comments are usually kept
@@ -144,7 +147,7 @@ int foo() {
144147
Ident id = (op == kEnum) ? 0 : 1;
145148
}
146149
,
147-
enum unnamed_1 { e1$_j e2 }alias unnamed_1 EX;
150+
enum unnamed_1 { e1$(_j) e2 }alias unnamed_1 EX;
148151
enum ENUM { kEnum };
149152
int foo() {
150153
Ident id = (op == ENUM.kEnum) ? 0 : 1;
@@ -157,14 +160,14 @@ template<typename TYPE>
157160
struct ArrayBase : Array {
158161
TYPE* data;
159162
};
160-
template<typename S$_j class T>
161-
double foo(S s$_j T t) { return s+t; }
163+
template<typename S$(_j) class T>
164+
double foo(S s$(_j) T t) { return s+t; }
162165
,
163166
class ArrayBase( TYPE) : Array {
164167
TYPE* data;
165168
};
166169

167-
double foo( S$_j T)(S s$_j T t) { return s+t; }
170+
double foo( S$(_j) T)(S s$(_j) T t) { return s+t; }
168171
)
169172

170173
Preprocessor macros are converted to enum, alias or templates

vdc/abothe/Parser

Submodule Parser updated 42 files

vdc/abothe/comserver/VDServer.cs

Lines changed: 117 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,47 @@ protected override void AppendFormat (string content, StringBuilder sb, FormatFl
6565
sb.Append (content);
6666
//base.AppendFormat (content, sb, flags, r, g, b);
6767
}
68-
}
68+
}
69+
70+
public class VDserverParseCacheView : ParseCacheView
71+
{
72+
#region Properties
73+
readonly List<RootPackage> packs;
74+
#endregion
75+
76+
#region Constructors
77+
public VDserverParseCacheView(IEnumerable<string> packageRoots)
78+
{
79+
this.packs = new List<RootPackage>();
80+
Add(packageRoots);
81+
}
82+
83+
public VDserverParseCacheView(IEnumerable<RootPackage> packages)
84+
{
85+
this.packs = new List<RootPackage>(packages);
86+
}
87+
#endregion
88+
89+
public override IEnumerable<RootPackage> EnumRootPackagesSurroundingModule(DModule module)
90+
{
91+
return packs;
92+
}
93+
94+
public void Add(RootPackage pack)
95+
{
96+
if (pack != null && !packs.Contains(pack))
97+
packs.Add(pack);
98+
}
99+
100+
public void Add(IEnumerable<string> roots)
101+
{
102+
RootPackage rp;
103+
foreach (var r in roots)
104+
if ((rp = GlobalParseCache.GetRootPackage(r)) != null && !packs.Contains(rp))
105+
packs.Add(rp);
106+
}
107+
}
69108

70-
71109

72110
[ComVisible(true), Guid(IID.VDServer)]
73111
[ClassInterface(ClassInterfaceType.None)]
@@ -100,14 +138,52 @@ public DModule GetModule(string fileName)
100138
public VDServer()
101139
{
102140
// MessageBox.Show("VDServer()");
103-
}
104-
105-
public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags)
141+
}
142+
143+
private static string normalizePath(string path)
144+
{
145+
path = Path.GetFullPath(path);
146+
return path.ToLower();
147+
}
148+
149+
private static string normalizeDir(string dir)
150+
{
151+
dir = normalizePath(dir);
152+
if (!dir.EndsWith("\\"))
153+
dir += '\\';
154+
return dir;
155+
}
156+
157+
private string[] uniqueDirectories(string imp)
158+
{
159+
var impDirs = imp.Split('\n');
160+
string[] normDirs = new string[impDirs.Length];
161+
for (int i = 0; i < impDirs.Length; i++)
162+
normDirs[i] = normalizeDir(impDirs[i]);
163+
164+
string[] uniqueDirs = new string[impDirs.Length];
165+
int unique = 0;
166+
for (int i = 0; i < normDirs.Length; i++)
167+
{
168+
int j;
169+
for (j = 0; j < normDirs.Length; j++)
170+
if (i != j && normDirs[i].StartsWith(normDirs[j]))
171+
if (normDirs[i] != normDirs[j] || j < i)
172+
break;
173+
if (j >= normDirs.Length)
174+
uniqueDirs[unique++] = normDirs[i];
175+
}
176+
177+
Array.Resize(ref uniqueDirs, unique);
178+
return uniqueDirs;
179+
}
180+
181+
public void ConfigureSemanticProject(string filename, string imp, string stringImp, string versionids, string debugids, uint flags)
106182
{
107183
if (_imports != imp)
108-
{
109-
var impDirs = imp.Split('\n');
110-
GlobalParseCache.BeginAddOrUpdatePaths(impDirs);
184+
{
185+
string[] uniqueDirs = uniqueDirectories(imp);
186+
GlobalParseCache.BeginAddOrUpdatePaths(uniqueDirs);
111187
}
112188
_imports = imp;
113189
_stringImports = stringImp;
@@ -124,7 +200,8 @@ public void ClearSemanticProject()
124200
//throw new NotImplementedException();
125201
}
126202
public void UpdateModule(string filename, string srcText, bool verbose)
127-
{
203+
{
204+
filename = normalizePath(filename);
128205
DModule ast;
129206
try
130207
{
@@ -159,8 +236,9 @@ static int getCodeOffset(string s, CodeLocation loc)
159236
}
160237

161238
public void GetTip(string filename, int startLine, int startIndex, int endLine, int endIndex)
162-
{
163-
var ast = GetModule(filename);
239+
{
240+
filename = normalizePath(filename);
241+
var ast = GetModule(filename);
164242

165243
if (ast == null)
166244
throw new COMException("module not found", 1);
@@ -176,14 +254,14 @@ public void GetTip(string filename, int startLine, int startIndex, int endLine,
176254
// codeOffset+1 because otherwise it does not work on the first character
177255
_editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 1;
178256

179-
ISyntaxRegion sr;
180-
DResolver.NodeResolutionAttempt attempt;
181-
var types = DResolver.ResolveTypeLoosely(_editorData, out attempt, out sr);
257+
ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData);
258+
LooseResolution.NodeResolutionAttempt attempt;
259+
var types = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt) : null;
182260

183261
_tipText.Clear();
184262

185263
if (types != null)
186-
{
264+
{
187265
if (sr != null)
188266
{
189267
_tipStart = sr.Location;
@@ -220,8 +298,9 @@ public void GetTipResult(out int startLine, out int startIndex, out int endLine,
220298
}
221299

222300
public void GetSemanticExpansions(string filename, string tok, uint line, uint idx, string expr)
223-
{
224-
var ast = GetModule(filename);
301+
{
302+
filename = normalizePath(filename);
303+
var ast = GetModule(filename);
225304

226305
if (ast == null)
227306
throw new COMException("module not found", 1);
@@ -254,8 +333,9 @@ public void GetSemanticExpansionsResult(out string stringList)
254333
}
255334

256335
public void GetParseErrors(string filename, out string errors)
257-
{
258-
var ast = GetModule(filename);
336+
{
337+
filename = normalizePath(filename);
338+
var ast = GetModule(filename);
259339

260340
if (ast == null)
261341
throw new COMException("module not found", 1);
@@ -276,6 +356,7 @@ public void GetParseErrors(string filename, out string errors)
276356

277357
public void IsBinaryOperator(string filename, uint startLine, uint startIndex, uint endLine, uint endIndex, out bool pIsOp)
278358
{
359+
filename = normalizePath(filename);
279360
var ast = GetModule(filename);
280361

281362
if (ast == null)
@@ -299,8 +380,9 @@ public void GetLastMessage(out string message)
299380
}
300381

301382
public void GetDefinition(string filename, int startLine, int startIndex, int endLine, int endIndex)
302-
{
303-
var ast = GetModule(filename);
383+
{
384+
filename = normalizePath(filename);
385+
var ast = GetModule(filename);
304386

305387
if (ast == null)
306388
throw new COMException("module not found", 1);
@@ -314,11 +396,11 @@ public void GetDefinition(string filename, int startLine, int startIndex, int en
314396
_editorData.SyntaxTree = ast as DModule;
315397
_editorData.ModuleCode = _sources[filename];
316398
// codeOffset+1 because otherwise it does not work on the first character
317-
_editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 2;
318-
319-
ISyntaxRegion sr;
320-
DResolver.NodeResolutionAttempt attempt;
321-
var rr = DResolver.ResolveTypeLoosely(_editorData, out attempt, out sr);
399+
_editorData.CaretOffset = getCodeOffset(_editorData.ModuleCode, _tipStart) + 2;
400+
401+
ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData);
402+
LooseResolution.NodeResolutionAttempt attempt;
403+
var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt) : null;
322404

323405
_tipText.Clear();
324406
if (rr != null)
@@ -355,6 +437,7 @@ public void GetDefinitionResult(out int startLine, out int startIndex, out int e
355437

356438
public void GetReferences(string filename, string tok, uint line, uint idx, string expr)
357439
{
440+
filename = normalizePath(filename);
358441
var ast = GetModule(filename);
359442

360443
if (ast == null)
@@ -369,9 +452,9 @@ public void GetReferences(string filename, string tok, uint line, uint idx, stri
369452

370453
_references = null;
371454

372-
ISyntaxRegion sr;
373-
DResolver.NodeResolutionAttempt attempt;
374-
var rr = DResolver.ResolveTypeLoosely(_editorData, out attempt, out sr);
455+
ISyntaxRegion sr = DResolver.GetScopedCodeObject(_editorData);
456+
LooseResolution.NodeResolutionAttempt attempt;
457+
var rr = sr != null ? LooseResolution.ResolveTypeLoosely(_editorData, sr, out attempt) : null;
375458

376459
StringBuilder refs = new StringBuilder();
377460
if (rr != null)
@@ -399,7 +482,7 @@ public void GetReferences(string filename, string tok, uint line, uint idx, stri
399482

400483
private static void GetReferencesInModule(DModule ast, StringBuilder refs, DNode n, ResolutionContext ctxt)
401484
{
402-
var res = ReferencesFinder.Scan(ast, n, ctxt);
485+
var res = ReferencesFinder.SearchModuleForASTNodeReferences(ast, n, ctxt);
403486

404487
int cnt = res.Count();
405488
foreach (var r in res)
@@ -439,9 +522,10 @@ void _setupEditorData()
439522
if ((_flags & 64) != 0)
440523
versions += "GNU\n";
441524
else
442-
versions += "DigitalMars\n";
443-
444-
_editorData.ParseCache = new ParseCacheView(_imports.Split('\n'));
525+
versions += "DigitalMars\n";
526+
527+
string[] uniqueDirs = uniqueDirectories(_imports);
528+
_editorData.ParseCache = new VDserverParseCacheView(uniqueDirs);
445529
_editorData.IsDebug = (_flags & 2) != 0;
446530
_editorData.DebugLevel = (_flags >> 16) & 0xff;
447531
_editorData.VersionNumber = (_flags >> 8) & 0xff;

0 commit comments

Comments
 (0)