fix #721 - disable GC while scanning to prevent GC to dispose some AST members (#725)

fix #721 - disable GC while scanning to prevent GC to dispose some AST members
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
BBasile 2018-11-29 08:41:08 +01:00 committed by The Dlang Bot
parent 5f3b973d9a
commit 83c89ddc22
2 changed files with 10 additions and 0 deletions

View File

@ -11,4 +11,7 @@ else
git submodule update --init --recursive
make test
make lint
git clone https://www.github.com/dlang/phobos.git --depth=1
# just check that it doesn't crash
cd phobos && ../bin/dscanner -S --config=.dscanner.ini || true
fi

View File

@ -5,6 +5,8 @@
module dscanner.analysis.run;
import core.memory : GC;
import std.stdio;
import std.array;
import std.conv;
@ -332,6 +334,8 @@ MessageSet analyze(string fileName, const Module m, const StaticAnalysisConfig a
scope(exit) typeid(Scope).destroy(first.moduleScope);
BaseAnalyzer[] checks;
GC.disable;
with(analysisConfig)
if (moduleName.shouldRun!"asm_style_check"(analysisConfig))
checks ~= new AsmStyleCheck(fileName, moduleScope,
@ -535,6 +539,9 @@ MessageSet analyze(string fileName, const Module m, const StaticAnalysisConfig a
foreach (check; checks)
foreach (message; check.messages)
set.insert(message);
GC.enable;
return set;
}