clang  6.0.0svn
TextDiagnosticBuffer.h
Go to the documentation of this file.
1 //===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This is a concrete diagnostic client, which buffers the diagnostic messages.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H
15 #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H
16 
17 #include "clang/Basic/Diagnostic.h"
18 #include <vector>
19 
20 namespace clang {
21 
22 class Preprocessor;
23 class SourceManager;
24 
26 public:
27  typedef std::vector<std::pair<SourceLocation, std::string> > DiagList;
28  typedef DiagList::iterator iterator;
29  typedef DiagList::const_iterator const_iterator;
30 private:
31  DiagList Errors, Warnings, Remarks, Notes;
32  /// All - All diagnostics in the order in which they were generated. That
33  /// order likely doesn't correspond to user input order, but it at least
34  /// keeps notes in the right places. Each pair in the vector is a diagnostic
35  /// level and an index into the corresponding DiagList above.
36  std::vector<std::pair<DiagnosticsEngine::Level, size_t>> All;
37 public:
38  const_iterator err_begin() const { return Errors.begin(); }
39  const_iterator err_end() const { return Errors.end(); }
40 
41  const_iterator warn_begin() const { return Warnings.begin(); }
42  const_iterator warn_end() const { return Warnings.end(); }
43 
44  const_iterator remark_begin() const { return Remarks.begin(); }
45  const_iterator remark_end() const { return Remarks.end(); }
46 
47  const_iterator note_begin() const { return Notes.begin(); }
48  const_iterator note_end() const { return Notes.end(); }
49 
51  const Diagnostic &Info) override;
52 
53  /// FlushDiagnostics - Flush the buffered diagnostics to an given
54  /// diagnostic engine.
55  void FlushDiagnostics(DiagnosticsEngine &Diags) const;
56 };
57 
58 } // end namspace clang
59 
60 #endif
const_iterator remark_end() const
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override
HandleDiagnostic - Store the errors, warnings, and notes that are reported.
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Definition: Diagnostic.h:1397
const_iterator err_end() const
const_iterator note_begin() const
const_iterator note_end() const
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:147
Defines the Diagnostic-related interfaces.
const_iterator err_begin() const
std::vector< std::pair< SourceLocation, std::string > > DiagList
DiagList::const_iterator const_iterator
const_iterator warn_end() const
Dataflow Directional Tag Classes.
const_iterator warn_begin() const
Level
The level of the diagnostic, after it has been through mapping.
Definition: Diagnostic.h:150
const_iterator remark_begin() const
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
Definition: Diagnostic.h:1227
void FlushDiagnostics(DiagnosticsEngine &Diags) const
FlushDiagnostics - Flush the buffered diagnostics to an given diagnostic engine.