Skip to content

Commit

Permalink
- dmdserver: updated to frontend of DMD 2.107.0
Browse files Browse the repository at this point in the history
- project template cache now removed if Visual D does not find itself in it.
  • Loading branch information
rainers committed Feb 25, 2024
1 parent 26b4888 commit 31769e7
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 21 deletions.
10 changes: 10 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -1357,3 +1357,13 @@ Version history
* "add imports from dependent projects" is now evaluated recursively and passed to semantic analysis
* added support for compiler option -preview=shortenedMethods
* fixed issue #264: VisualD doesn't run compiled executable, when I select "Compile and Run" option

2024-02-25 version 1.4.0-rc1
* dmdserver: updated to frontend of DMD 2.107.0
* full installer now bundled with DMD 2.107.0 and LDC 1.36.0
* mago: fix crash due to changed return values from IDiaSession in VS2022, probably fixes
issue #261
* fixed issue #269: avoid BOM in response file if system codepage is UTF-8
* project template cache now removed if Visual D does not find itself in it. Workaround for
issue #256
* fixed some version inaccuracies in installation files
2 changes: 1 addition & 1 deletion c2d/pp.d
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ class ConditionalCode

void convertMultipleElseIf()
{
assert("not implemented");
assert(!"not implemented");
}

void convertMultipleOpenElseIf()
Expand Down
7 changes: 6 additions & 1 deletion msbuild/dbuild/CompileD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ protected override Encoding ResponseFileEncoding
if (Compiler == "LDC")
return new UTF8Encoding(false);
else
return System.Text.Encoding.GetEncoding(GetACP());
{
int cp = GetACP();
if (cp == 65001)
return new UTF8Encoding(false); // no BOM
return System.Text.Encoding.GetEncoding(cp);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions nsis/visuald.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

; define DMD source path to include dmd installation
; !define DMD
!define DMD_VERSION "2.106.0"
!define DMD_VERSION "2.107.0"
!define DMD_SRC c:\d\dmd-${DMD_VERSION}

; define LDC to include ldc installation
; !define LDC
!define LDC_VERSION "1.35.0"
!define LDC_VERSION "1.36.0"
!define LDC_SRC c:\d\ldc2-${LDC_VERSION}-windows-multilib

; define VS2019 to include VS2019 support
Expand Down
18 changes: 18 additions & 0 deletions sdk/vsi.visualdproj
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,16 @@
<File path="vsi\msdbg168.d" />
<File path="vsi\msdbg169.d" />
<File path="vsi\msdbg16a.d" />
<File path="vsi\msdbg170.d" />
<File path="vsi\msdbg171.d" />
<File path="vsi\msdbg172.d" />
<File path="vsi\msdbg173.d" />
<File path="vsi\msdbg174.d" />
<File path="vsi\msdbg175.d" />
<File path="vsi\msdbg176.d" />
<File path="vsi\msdbg177.d" />
<File path="vsi\msdbg178.d" />
<File path="vsi\msdbg179.d" />
<File path="vsi\msdbg90.d" />
<File path="vsi\objext.d" />
<File path="vsi\ocdesign.d" />
Expand Down Expand Up @@ -2294,6 +2304,14 @@
<File path="vsi\vsshell166.d" />
<File path="vsi\vsshell167.d" />
<File path="vsi\vsshell169.d" />
<File path="vsi\vsshell171.d" />
<File path="vsi\vsshell172.d" />
<File path="vsi\vsshell174.d" />
<File path="vsi\vsshell175.d" />
<File path="vsi\vsshell176.d" />
<File path="vsi\vsshell177.d" />
<File path="vsi\vsshell178.d" />
<File path="vsi\vsshell179.d" />
<File path="vsi\vsshell2.d" />
<File path="vsi\vsshell80.d" />
<File path="vsi\vsshell90.d" />
Expand Down
2 changes: 1 addition & 1 deletion vdc/dmdserver/dmd
Submodule dmd updated 533 files
2 changes: 1 addition & 1 deletion vdc/dmdserver/dmdserver.visualdproj
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@
<File path="dmd\compiler\src\dmd\common\file.d" />
<File path="dmd\compiler\src\dmd\common\int128.d" />
<File path="dmd\compiler\src\dmd\common\outbuffer.d" />
<File path="dmd\compiler\src\dmd\common\string.d" />
<File path="dmd\compiler\src\dmd\common\smallbuffer.d" />
</Folder>
<Folder name="root">
<File path="dmd\compiler\src\dmd\root\aav.d" />
Expand Down
2 changes: 1 addition & 1 deletion vdc/dmdserver/semanalysis.d
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void do_unittests()
import dmd.hdrgen;
auto buf = OutBuffer();
buf.doindent = 1;
moduleToBuffer(buf, mod);
moduleToBuffer(buf, false, mod);

OutputDebugStringA(buf.peekChars);
}
Expand Down
26 changes: 13 additions & 13 deletions vdc/dmdserver/semvisitor.d
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,9 @@ TipData tipForDeclaration(Declaration decl)
auto fntype = decl.type ? decl.type.isTypeFunction() : null;

if (auto td = fntype && decl.parent ? decl.parent.isTemplateDeclaration() : null)
functionToBufferFull(fntype, buf, decl.getIdent(), &hgs, td);
functionToBufferFull(fntype, buf, decl.getIdent(), hgs, td);
else if (fntype)
functionToBufferWithIdent(fntype, buf, decl.toPrettyChars(true), &hgs, func.isStatic);
functionToBufferWithIdent(fntype, buf, decl.toPrettyChars(true), hgs, func.isStatic);
else
buf.writestring(decl.toPrettyChars(true));
auto res = buf.extractSlice(); // take ownership
Expand Down Expand Up @@ -2524,7 +2524,7 @@ string[] findExpansions(Module mod, int line, int index, string tok)

case EXP.dotVariable:
case EXP.dotIdentifier:
flags |= SearchLocalsOnly;
flags |= SearchOpt.localsOnly;
if (recursed)
if (auto dve = e.isDotVarExp())
if (dve.varloc.filename) // skip compiler generated idents (alias this)
Expand All @@ -2534,7 +2534,7 @@ string[] findExpansions(Module mod, int line, int index, string tok)
return getType(e1, true);

case EXP.dot:
flags |= SearchLocalsOnly;
flags |= SearchOpt.localsOnly;
return (cast(DotExp)e).e1.type;
default:
return recursed ? e.type : null;
Expand Down Expand Up @@ -2593,9 +2593,9 @@ string[] findExpansions(Module mod, int line, int index, string tok)
{
if (!sym)
return;
int sflags = SearchLocalsOnly;
int sflags = SearchOpt.localsOnly;
if (sym.getModule() == mod)
sflags |= IgnoreSymbolVisibility;
sflags |= SearchOpt.ignoreVisibility;
searchScope(sym, sflags);
}
// base classes
Expand Down Expand Up @@ -2638,14 +2638,14 @@ string[] findExpansions(Module mod, int line, int index, string tok)
}
}

if (flags & SearchLocalsOnly)
if (flags & SearchOpt.localsOnly)
break;

// imported modules
size_t cnt = sd.importedScopes ? sd.importedScopes.dim : 0;
for (size_t i = 0; i < cnt; i++)
{
if ((flags & IgnorePrivateImports) && sd.visibilities[i] == Visibility.Kind.private_)
if ((flags & SearchOpt.ignorePrivateImports) && sd.visibilities[i] == Visibility.Kind.private_)
continue;
auto ss = (*sd.importedScopes)[i].isScopeDsymbol();
if (!ss)
Expand All @@ -2654,17 +2654,17 @@ string[] findExpansions(Module mod, int line, int index, string tok)
int sflags = 0;
if (ss.isModule())
{
if (flags & SearchLocalsOnly)
if (flags & SearchOpt.localsOnly)
continue;
sflags |= IgnorePrivateImports;
sflags |= SearchOpt.ignorePrivateImports;
}
else // mixin template
{
if (flags & SearchImportsOnly)
if (flags & SearchOpt.importsOnly)
continue;
sflags |= SearchLocalsOnly;
sflags |= SearchOpt.localsOnly;
}
searchScope(ss, sflags | IgnorePrivateImports);
searchScope(ss, sflags | SearchOpt.ignorePrivateImports);
}
}
}
Expand Down
39 changes: 39 additions & 0 deletions visuald/dpackage.d
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ version(none)

mOptions.initFromRegistry();

mOptions.checkTemplateCache();

// debug dumpFontsAndColors();

//register with ComponentManager for Idle processing
Expand Down Expand Up @@ -1918,6 +1920,43 @@ class GlobalOptions
baseInstallDir = "c:\\D";
}

bool checkTemplateCache()
{
bool rc = true;
try
{
if(!getRegistryRoot())
return false;
if (regUserRoot.toUpper.startsWith("SOFTWARE\\"w))
{
auto localpath = "$(LOCALAPPDATA)" ~ to!string(regUserRoot[8..$]);
localpath = replaceGlobalMacros(localpath);
if(isExistingDir(localpath))
{
string[] toRemove;
foreach (string fname; dirEntries(localpath, SpanMode.shallow))
{
if (globMatch(baseName(fname), "NpdProjectTemplateCache*"))
{
auto content = cast(ubyte[])std.file.read(fname);
if (find(content, cast(ubyte[])"\"Visual D\"").empty)
toRemove ~= fname;
}
}
foreach (string fname; toRemove)
std.file.remove(fname);
}
}
}
catch(Exception e)
{
writeToBuildOutputPane(e.msg);
rc = false;
}

return rc;
}

bool initFromRegistry(bool restoreDefaults = false)
{
bool rc = true;
Expand Down
2 changes: 1 addition & 1 deletion visuald/register.d
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ HRESULT VSDllRegisterServerInternal(in wchar* pszRegRoot, in bool useRanu)
else if (ver == 16)
dbuildPath = instPath ~ "\\msbuild\\dbuild.16.0.dll"w;
else if (ver == 17)
dbuildPath = instPath ~ "\\msbuild\\dbuild.16.0.dll"w;
dbuildPath = instPath ~ "\\msbuild\\dbuild.17.0.dll"w;

wstring vdext15Path;
if (ver >= 15)
Expand Down

0 comments on commit 31769e7

Please sign in to comment.