clang: lib/ARCMigrate/PlistReporter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14using namespace clang;
15using namespace arcmt;
16using namespace markup;
17
19 switch (Level) {
21 llvm_unreachable("ignored");
23 return "note";
26 return "warning";
29 return "error";
30 }
31 llvm_unreachable("Invalid DiagnosticsEngine level!");
32}
33
39
40
41
44
46 I = diags.begin(), E = diags.end(); I != E; ++I) {
48
50
52 RI = D.range_begin(), RE = D.range_end(); RI != RE; ++RI) {
53 AddFID(FM, Fids, SM, RI->getBegin());
54 AddFID(FM, Fids, SM, RI->getEnd());
55 }
56 }
57
58 std::error_code EC;
59 llvm::raw_fd_ostream o(outPath, EC, llvm::sys::fs::OF_TextWithCRLF);
60 if (EC) {
61 llvm::errs() << "error: could not create file: " << outPath << '\n';
62 return;
63 }
64
66
67
68
69
70 o << "\n"
71 " files\n"
72 " \n";
73
74 for (FileID FID : Fids)
75 EmitString(o << " ", SM.getFileEntryRefForID(FID)->getName()) << '\n';
76
77 o << " \n"
78 " diagnostics\n"
79 " \n";
80
82 DI = diags.begin(), DE = diags.end(); DI != DE; ++DI) {
83
85
87 continue;
88
89 o << " \n";
90
91
92 o << " description";
94 o << " category";
97 o << " type";
99
100
101 o << " location\n";
103
104
105 if (.getRanges().empty()) {
106 o << " ranges\n";
107 o << " \n";
108 for (auto &R : D.getRanges()) {
111 FM, 4);
112 }
113 o << " \n";
114 }
115
116
117 o << " \n";
118 }
119
120 o << " \n";
121
122
123 o << "\n\n";
124}
Defines the clang::FileManager interface and associated types.
static StringRef getLevelName(DiagnosticsEngine::Level Level)
Defines the SourceManager interface.
Represents a character-granular source range.
SourceLocation getLocation() const
Used for handling and querying diagnostic IDs.
static StringRef getCategoryNameFromID(unsigned CategoryID)
Given a category ID, return the name of the category.
static unsigned getCategoryNumberForDiag(unsigned DiagID)
Return the category number that a specified DiagID belongs to, or 0 if no category.
Level
The level of the diagnostic, after it has been through mapping.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static CharSourceRange getAsCharRange(SourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)
Given a token range, produce a corresponding CharSourceRange that is not a token range.
This class handles loading and caching of source files into memory.
Represents a diagnostic in a form that can be retained until its corresponding source manager is dest...
std::vector< CharSourceRange >::const_iterator range_iterator
void writeARCDiagsToPlist(const std::string &outPath, ArrayRef< StoredDiagnostic > diags, SourceManager &SM, const LangOptions &LangOpts)
void EmitRange(raw_ostream &o, const SourceManager &SM, CharSourceRange R, const FIDMap &FM, unsigned indent)
raw_ostream & EmitString(raw_ostream &o, StringRef s)
unsigned AddFID(FIDMap &FIDs, SmallVectorImpl< FileID > &V, FileID FID)
llvm::DenseMap< FileID, unsigned > FIDMap
raw_ostream & EmitPlistHeader(raw_ostream &o)
void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent)
The JSON file list parser is used to communicate input to InstallAPI.