Home | History | Annotate | Download | only in compiler
      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 //
      6 
      7 #ifndef COMPILER_DIAGNOSTICS_H_
      8 #define COMPILER_DIAGNOSTICS_H_
      9 
     10 #include "compiler/preprocessor/DiagnosticsBase.h"
     11 
     12 class TInfoSink;
     13 
     14 class TDiagnostics : public pp::Diagnostics
     15 {
     16   public:
     17     TDiagnostics(TInfoSink& infoSink);
     18     virtual ~TDiagnostics();
     19 
     20     TInfoSink& infoSink() { return mInfoSink; }
     21 
     22     int numErrors() const { return mNumErrors; }
     23     int numWarnings() const { return mNumWarnings; }
     24 
     25     void writeInfo(Severity severity,
     26                    const pp::SourceLocation& loc,
     27                    const std::string& reason,
     28                    const std::string& token,
     29                    const std::string& extra);
     30 
     31     void writeDebug(const std::string& str);
     32 
     33   protected:
     34     virtual void print(ID id,
     35                        const pp::SourceLocation& loc,
     36                        const std::string& text);
     37 
     38   private:
     39     TInfoSink& mInfoSink;
     40     int mNumErrors;
     41     int mNumWarnings;
     42 };
     43 
     44 #endif  // COMPILER_DIAGNOSTICS_H_
     45