aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLCompiler.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-06-21 21:25:26 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-21 21:25:43 +0000
commite0a33e28e2786fb17be2edf28e04cd62bfe4ec1e (patch)
treeb1b84386a5eba32f0b7e533a5ce1e26754e67d41 /src/sksl/SkSLCompiler.cpp
parent93a2346dfa6a97e5631086082e74c7b38febf68b (diff)
Revert "clean up sksl dead variable handling"
This reverts commit b29dd819c9f4cc0f33c24a10b128c363a4c83a6f. Reason for revert: asan errors Original change's description: > clean up sksl dead variable handling > > Change-Id: I301e82bf87d976e59a02b0f383da67eaf5a8795a > Reviewed-on: https://skia-review.googlesource.com/18494 > Reviewed-by: Chris Dalton <csmartdalton@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> TBR=csmartdalton@google.com,ethannicholas@google.com Change-Id: I32b3c6a04a014b31360d92b3f85491b01e8a381c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/20480 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/sksl/SkSLCompiler.cpp')
-rw-r--r--src/sksl/SkSLCompiler.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 0818b75fed..2d541a3b53 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -1024,11 +1024,11 @@ void Compiler::scanCFG(FunctionDefinition& f) {
} while (updated);
ASSERT(!needsRescan);
- // verify static ifs & switches, clean up dead variable decls
+ // verify static ifs & switches
for (BasicBlock& b : cfg.fBlocks) {
DefinitionMap definitions = b.fBefore;
- for (auto iter = b.fNodes.begin(); iter != b.fNodes.end() && !needsRescan;) {
+ for (auto iter = b.fNodes.begin(); iter != b.fNodes.end() && !needsRescan; ++iter) {
if (iter->fKind == BasicBlock::Node::kStatement_Kind) {
const Statement& s = **iter->statement();
switch (s.fKind) {
@@ -1036,36 +1036,15 @@ void Compiler::scanCFG(FunctionDefinition& f) {
if (((const IfStatement&) s).fIsStatic) {
this->error(s.fPosition, "static if has non-static test");
}
- ++iter;
break;
case Statement::kSwitch_Kind:
if (((const SwitchStatement&) s).fIsStatic) {
this->error(s.fPosition, "static switch has non-static test");
}
- ++iter;
break;
- case Statement::kVarDeclarations_Kind: {
- VarDeclarations& decls = *((VarDeclarationsStatement&) s).fDeclaration;
- for (auto varIter = decls.fVars.begin(); varIter != decls.fVars.end();) {
- if ((*varIter)->fKind == Statement::kNop_Kind) {
- varIter = decls.fVars.erase(varIter);
- } else {
- ++varIter;
- }
- }
- if (!decls.fVars.size()) {
- iter = b.fNodes.erase(iter);
- } else {
- ++iter;
- }
- break;
- }
default:
- ++iter;
break;
}
- } else {
- ++iter;
}
}
}