Commit cb3236d9 by Lei Zhang

Use std::string for TBD/missing functionality reporting.

We can have multiple instances of the same string, so comparing const char* is not guaranteed working. Fixed the failure on VS 2013 with Debug build.
parent f36d6e35
...@@ -40,13 +40,13 @@ ...@@ -40,13 +40,13 @@
namespace spv { namespace spv {
void SpvBuildLogger::tbdFunctionality(const char* f) void SpvBuildLogger::tbdFunctionality(const std::string& f)
{ {
if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures)) if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures))
tbdFeatures.push_back(f); tbdFeatures.push_back(f);
} }
void SpvBuildLogger::missingFunctionality(const char* f) void SpvBuildLogger::missingFunctionality(const std::string& f)
{ {
if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures)) if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures))
missingFeatures.push_back(f); missingFeatures.push_back(f);
......
...@@ -48,9 +48,9 @@ public: ...@@ -48,9 +48,9 @@ public:
SpvBuildLogger(const SpvBuildLogger&) = delete; SpvBuildLogger(const SpvBuildLogger&) = delete;
// Registers a TBD functionality. // Registers a TBD functionality.
void tbdFunctionality(const char* f); void tbdFunctionality(const std::string& f);
// Registers a missing functionality. // Registers a missing functionality.
void missingFunctionality(const char* f); void missingFunctionality(const std::string& f);
// Logs a warning. // Logs a warning.
void warning(const std::string& w) { warnings.push_back(w); } void warning(const std::string& w) { warnings.push_back(w); }
...@@ -62,8 +62,8 @@ public: ...@@ -62,8 +62,8 @@ public:
std::string getAllMessages() const; std::string getAllMessages() const;
private: private:
std::vector<const char*> tbdFeatures; std::vector<std::string> tbdFeatures;
std::vector<const char*> missingFeatures; std::vector<std::string> missingFeatures;
std::vector<std::string> warnings; std::vector<std::string> warnings;
std::vector<std::string> errors; std::vector<std::string> errors;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment