Path: blob/master/thirdparty/glslang/SPIRV/Logger.cpp
9902 views
//1// Copyright (C) 2016 Google, Inc.2//3// All rights reserved.4//5// Redistribution and use in source and binary forms, with or without6// modification, are permitted provided that the following conditions7// are met:8//9// Redistributions of source code must retain the above copyright10// notice, this list of conditions and the following disclaimer.11//12// Redistributions in binary form must reproduce the above13// copyright notice, this list of conditions and the following14// disclaimer in the documentation and/or other materials provided15// with the distribution.16//17// Neither the name of Google Inc. nor the names of its18// contributors may be used to endorse or promote products derived19// from this software without specific prior written permission.20//21// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS22// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT23// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS24// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE25// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,26// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,27// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;28// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER29// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN31// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE32// POSSIBILITY OF SUCH DAMAGE.3334#include "Logger.h"3536#include <algorithm>37#include <iterator>38#include <sstream>3940namespace spv {4142void SpvBuildLogger::tbdFunctionality(const std::string& f)43{44if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures))45tbdFeatures.push_back(f);46}4748void SpvBuildLogger::missingFunctionality(const std::string& f)49{50if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures))51missingFeatures.push_back(f);52}5354std::string SpvBuildLogger::getAllMessages() const {55std::ostringstream messages;56for (auto it = tbdFeatures.cbegin(); it != tbdFeatures.cend(); ++it)57messages << "TBD functionality: " << *it << "\n";58for (auto it = missingFeatures.cbegin(); it != missingFeatures.cend(); ++it)59messages << "Missing functionality: " << *it << "\n";60for (auto it = warnings.cbegin(); it != warnings.cend(); ++it)61messages << "warning: " << *it << "\n";62for (auto it = errors.cbegin(); it != errors.cend(); ++it)63messages << "error: " << *it << "\n";64return messages.str();65}6667} // end spv namespace686970