gfx/angle/src/compiler/Diagnostics.cpp

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 //
     2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
     3 // Use of this source code is governed by a BSD-style license that can be
     4 // found in the LICENSE file.
     5 //
     7 #include "compiler/Diagnostics.h"
     9 #include "compiler/compiler_debug.h"
    10 #include "compiler/InfoSink.h"
    11 #include "compiler/preprocessor/SourceLocation.h"
    13 TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
    14     mInfoSink(infoSink),
    15     mNumErrors(0),
    16     mNumWarnings(0)
    17 {
    18 }
    20 TDiagnostics::~TDiagnostics()
    21 {
    22 }
    24 void TDiagnostics::writeInfo(Severity severity,
    25                              const pp::SourceLocation& loc,
    26                              const std::string& reason,
    27                              const std::string& token,
    28                              const std::string& extra)
    29 {
    30     TPrefixType prefix = EPrefixNone;
    31     switch (severity)
    32     {
    33       case ERROR:
    34         ++mNumErrors;
    35         prefix = EPrefixError;
    36         break;
    37       case WARNING:
    38         ++mNumWarnings;
    39         prefix = EPrefixWarning;
    40         break;
    41       default:
    42         UNREACHABLE();
    43         break;
    44     }
    46     TInfoSinkBase& sink = mInfoSink.info;
    47     /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
    48     sink.prefix(prefix);
    49     sink.location(loc.file, loc.line);
    50     sink << "'" << token <<  "' : " << reason << " " << extra << "\n";
    51 }
    53 void TDiagnostics::writeDebug(const std::string& str)
    54 {
    55     mInfoSink.debug << str;
    56 }
    58 void TDiagnostics::print(ID id,
    59                          const pp::SourceLocation& loc,
    60                          const std::string& text)
    61 {
    62     writeInfo(severity(id), loc, message(id), text, "");
    63 }

mercurial