From ff00056daddbce2e6e16f7c09dcfcb5cde66e85c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 5 Mar 2021 21:03:48 +0200 Subject: [PATCH] Mark function return types as used --- source/glsl/optimize.cpp | 6 ++++++ source/glsl/optimize.h | 1 + 2 files changed, 7 insertions(+) diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 88a32399..9d9464e4 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -653,6 +653,12 @@ void UnusedTypeRemover::visit(VariableDeclaration &var) unused_nodes.erase(var.type_declaration); } +void UnusedTypeRemover::visit(FunctionDeclaration &func) +{ + unused_nodes.erase(func.return_type_declaration); + TraversingVisitor::visit(func); +} + UnusedVariableRemover::UnusedVariableRemover(): aggregate(0), diff --git a/source/glsl/optimize.h b/source/glsl/optimize.h index 85f11780..92e19c8c 100644 --- a/source/glsl/optimize.h +++ b/source/glsl/optimize.h @@ -179,6 +179,7 @@ private: virtual void visit(ImageTypeDeclaration &); virtual void visit(StructDeclaration &); virtual void visit(VariableDeclaration &); + virtual void visit(FunctionDeclaration &); }; /** Removes variable declarations with no references to them. Assignment -- 2.45.2