From d47f8b3fd8222c5105e9b2730789c16371499ecf Mon Sep 17 00:00:00 2001 From: David Neto Date: Mon, 4 Jan 2016 17:27:34 -0500 Subject: [PATCH] Avoid parameter shadowing in source/diagnostic.h Change the offending class to more closely follow Google C++ style: - Member names have a trailing underscore. - Use an accessor method for the stream_ member. --- source/diagnostic.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/diagnostic.h b/source/diagnostic.h index 7c82b7f..9841df2 100644 --- a/source/diagnostic.h +++ b/source/diagnostic.h @@ -37,21 +37,22 @@ namespace libspirv { class diagnostic_helper { public: - diagnostic_helper(spv_position_t& position, spv_diagnostic* pDiagnostic) - : position(&position), pDiagnostic(pDiagnostic) {} + diagnostic_helper(spv_position_t& position, spv_diagnostic* diagnostic) + : position_(&position), diagnostic_(diagnostic) {} - diagnostic_helper(spv_position position, spv_diagnostic* pDiagnostic) - : position(position), pDiagnostic(pDiagnostic) {} + diagnostic_helper(spv_position position, spv_diagnostic* diagnostic) + : position_(position), diagnostic_(diagnostic) {} ~diagnostic_helper() { - *pDiagnostic = spvDiagnosticCreate(position, stream.str().c_str()); + *diagnostic_ = spvDiagnosticCreate(position_, stream().str().c_str()); } - std::stringstream stream; + std::stringstream& stream() { return stream_; } private: - spv_position position; - spv_diagnostic* pDiagnostic; + std::stringstream stream_; + spv_position position_; + spv_diagnostic* diagnostic_; }; // A DiagnosticStream remembers the current position of the input and an error @@ -99,7 +100,7 @@ class DiagnosticStream { #define DIAGNOSTIC \ libspirv::diagnostic_helper helper(position, pDiagnostic); \ - helper.stream + helper.stream() } // namespace libspirv -- 2.7.4