summaryrefslogtreecommitdiff
path: root/source/diagnostic.h
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2016-01-04 17:27:34 -0500
committerDavid Neto <dneto@google.com>2016-01-06 13:11:42 -0500
commitd47f8b3fd8222c5105e9b2730789c16371499ecf (patch)
treef4c4194f9ab07bdaaa1af6ee4c0635abaa62fc6b /source/diagnostic.h
parent969ce4b3236a46a5264c7e003cfb029a1b32d559 (diff)
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.
Diffstat (limited to 'source/diagnostic.h')
-rw-r--r--source/diagnostic.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/diagnostic.h b/source/diagnostic.h
index 7c82b7f0..9841df2a 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