30 #include "llvm/ADT/ArrayRef.h" 31 #include "llvm/ADT/SmallString.h" 32 #include "llvm/ADT/StringRef.h" 33 #include "llvm/ADT/iterator_range.h" 34 #include "llvm/Support/Casting.h" 35 #include "llvm/Support/Errc.h" 36 #include "llvm/Support/ErrorHandling.h" 37 #include "llvm/Support/FileSystem.h" 38 #include "llvm/Support/MemoryBuffer.h" 39 #include "llvm/Support/Path.h" 40 #include "llvm/Support/raw_ostream.h" 48 #include <system_error> 52 using namespace clang;
62 std::string Directory;
63 bool createdDir =
false;
67 const bool SupportsCrossFileDiagnostics;
71 const std::string& prefix,
73 bool supportsMultipleFiles)
74 : Directory(prefix), PP(pp), AnalyzerOpts(AnalyzerOpts),
75 SupportsCrossFileDiagnostics(supportsMultipleFiles) {}
77 ~HTMLDiagnostics()
override { FlushDiagnostics(
nullptr); }
79 void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
80 FilesMade *filesMade)
override;
82 StringRef
getName()
const override {
83 return "HTMLDiagnostics";
86 bool supportsCrossFileDiagnostics()
const override {
87 return SupportsCrossFileDiagnostics;
90 unsigned ProcessMacroPiece(raw_ostream &os,
98 const char *HighlightStart =
"<span class=\"mrange\">",
99 const char *HighlightEnd =
"</span>");
102 FilesMade *filesMade);
107 const char *declName);
119 std::string generateKeyboardNavigationJavascript();
123 std::string showHelpJavascript();
130 const std::string& prefix,
132 C.push_back(
new HTMLDiagnostics(AnalyzerOpts, prefix, PP,
true));
135 void ento::createHTMLSingleFileDiagnosticConsumer(
AnalyzerOptions &AnalyzerOpts,
137 const std::string& prefix,
139 C.push_back(
new HTMLDiagnostics(AnalyzerOpts, prefix, PP,
false));
146 void HTMLDiagnostics::FlushDiagnosticsImpl(
147 std::vector<const PathDiagnostic *> &Diags,
148 FilesMade *filesMade) {
149 for (
const auto Diag : Diags)
154 FilesMade *filesMade) {
158 if (std::error_code ec = llvm::sys::fs::create_directories(Directory)) {
159 llvm::errs() <<
"warning: could not create directory '" 160 << Directory <<
"': " << ec.message() <<
'\n';
173 assert(!path.empty());
174 const SourceManager &SMgr = path.front()->getLocation().getManager();
182 FileID ReportFile = path.front()->getLocation().asLocation().getExpansionLoc().getFileID();
188 if (
const auto *ND = dyn_cast<NamedDecl>(DeclWithIssue))
189 declName = ND->getDeclName().getAsString();
191 if (
const Stmt *Body = DeclWithIssue->getBody()) {
195 SMgr.getExpansionLoc(path.back()->getLocation().asLocation()),
197 FullSourceLoc FunL(SMgr.getExpansionLoc(Body->getLocStart()), SMgr);
198 offsetDecl = L.getExpansionLineNumber() - FunL.getExpansionLineNumber();
202 std::string report = GenerateHTML(D, R, SMgr, path, declName.c_str());
203 if (report.empty()) {
204 llvm::errs() <<
"warning: no diagnostics generated for main file.\n";
213 llvm::sys::path::append(Model, Directory,
"report-%%%%%%.html");
214 if (std::error_code EC =
215 llvm::sys::fs::make_absolute(Model)) {
216 llvm::errs() <<
"warning: could not make '" << Model
217 <<
"' absolute: " << EC.message() <<
'\n';
220 if (std::error_code EC =
221 llvm::sys::fs::createUniqueFile(Model, FD, ResultPath)) {
222 llvm::errs() <<
"warning: could not create file in '" << Directory
223 <<
"': " << EC.message() <<
'\n';
231 const FileEntry* Entry = SMgr.getFileEntryForID(ReportFile);
232 std::stringstream filename;
234 filename <<
"report-" 235 << llvm::sys::path::filename(Entry->
getName()).str()
236 <<
"-" << declName.c_str()
238 <<
"-" << i <<
".html";
239 llvm::sys::path::append(Model, Directory,
241 EC = llvm::sys::fs::openFileForReadWrite(
242 Model, FD, llvm::sys::fs::CD_CreateNew, llvm::sys::fs::OF_None);
243 if (EC && EC != llvm::errc::file_exists) {
244 llvm::errs() <<
"warning: could not create file '" << Model
245 <<
"': " << EC.message() <<
'\n';
252 llvm::raw_fd_ostream os(FD,
true);
255 filesMade->addDiagnostic(D,
getName(),
256 llvm::sys::path::filename(ResultPath));
265 std::vector<FileID> FileIDs;
266 for (
auto I : path) {
267 FileID FID = I->getLocation().asLocation().getExpansionLoc().getFileID();
268 if (std::find(FileIDs.begin(), FileIDs.end(), FID) != FileIDs.end())
271 FileIDs.push_back(FID);
272 RewriteFile(R, SMgr, path, FID);
275 if (SupportsCrossFileDiagnostics && FileIDs.size() > 1) {
277 for (
auto I = FileIDs.begin(), E = FileIDs.end(); I != E; I++) {
279 llvm::raw_string_ostream os(s);
281 if (I != FileIDs.begin())
282 os <<
"<hr class=divider>\n";
284 os <<
"<div id=File" << I->getHashValue() <<
">\n";
287 if (I != FileIDs.begin())
288 os <<
"<div class=FileNav><a href=\"#File" << (I - 1)->getHashValue()
289 <<
"\">←</a></div>";
296 os <<
"<div class=FileNav><a href=\"#File" << (I + 1)->getHashValue()
297 <<
"\">→</a></div>";
305 for (
auto I : llvm::make_range(FileIDs.begin() + 1, FileIDs.end())) {
307 llvm::raw_string_ostream os(s);
323 path.back()->getLocation().asLocation().getExpansionLoc().getFileID();
325 FinalizeHTML(D, R, SMgr, path, FileIDs[0], Entry, declName);
328 llvm::raw_string_ostream os(file);
339 llvm::raw_string_ostream &os) {
341 std::map<unsigned, std::set<unsigned>> ExecutedLines;
344 std::set<unsigned> &LinesInFile = ExecutedLines[I->first];
345 for (
unsigned LineNo : I->second) {
346 LinesInFile.insert(LineNo);
351 for (
const auto &
P : path) {
358 os <<
"var relevant_lines = {";
359 for (
auto I = ExecutedLines.begin(),
360 E = ExecutedLines.end(); I != E; ++I) {
361 if (I != ExecutedLines.begin())
364 os <<
"\"" << I->first <<
"\": {";
365 for (
unsigned LineNo : I->second) {
366 if (LineNo != *(I->second.begin()))
369 os <<
"\"" << LineNo <<
"\": 1";
381 llvm::raw_string_ostream os(s);
382 os <<
"<script type='text/javascript'>\n";
386 var filterCounterexample = function (hide) { 387 var tables = document.getElementsByClassName("code"); 388 for (var t=0; t<tables.length; t++) { 389 var table = tables[t]; 390 var file_id = table.getAttribute("data-fileid"); 391 var lines_in_fid = relevant_lines[file_id]; 395 var lines = table.getElementsByClassName("codeline"); 396 for (var i=0; i<lines.length; i++) { 398 var lineNo = el.getAttribute("data-linenumber"); 399 if (!lines_in_fid[lineNo]) { 401 el.setAttribute("hidden", ""); 403 el.removeAttribute("hidden"); 410 window.addEventListener("keydown", function (event) { 411 if (event.defaultPrevented) { 414 if (event.key == "S") { 415 var checked = document.getElementsByName("showCounterexample")[0].checked; 416 filterCounterexample(!checked); 417 document.getElementsByName("showCounterexample")[0].checked = !checked; 421 event.preventDefault(); 424 document.addEventListener("DOMContentLoaded", function() { 425 document.querySelector('input[name="showCounterexample"]').onchange= 427 filterCounterexample(this.checked); 433 <input type="checkbox" name="showCounterexample" id="showCounterexample" /> 434 <label for="showCounterexample"> 435 Show only relevant lines 445 const FileEntry *Entry,
const char *declName) {
452 if (llvm::sys::path::is_relative(Entry->
getName())) {
453 llvm::sys::fs::current_path(DirName);
457 int LineNumber = path.back()->getLocation().asLocation().getExpansionLineNumber();
458 int ColumnNumber = path.back()->getLocation().asLocation().getExpansionColumnNumber();
463 generateKeyboardNavigationJavascript());
472 llvm::raw_string_ostream os(s);
474 os <<
"<!-- REPORTHEADER -->\n" 475 <<
"<h3>Bug Summary</h3>\n<table class=\"simpletable\">\n" 476 "<tr><td class=\"rowname\">File:</td><td>" 479 <<
"</td></tr>\n<tr><td class=\"rowname\">Warning:</td><td>" 480 "<a href=\"#EndPath\">line " 488 unsigned NumExtraPieces = 0;
489 for (
const auto &Piece : path) {
490 if (
const auto *
P = dyn_cast<PathDiagnosticNotePiece>(Piece.get())) {
492 P->getLocation().asLocation().getExpansionLineNumber();
494 P->getLocation().asLocation().getExpansionColumnNumber();
495 os <<
"<tr><td class=\"rowname\">Note:</td><td>" 496 <<
"<a href=\"#Note" << NumExtraPieces <<
"\">line " 497 << LineNumber <<
", column " << ColumnNumber <<
"</a><br />" 498 <<
P->getString() <<
"</td></tr>";
512 <!-- REPORTSUMMARYEXTRA --> 513 <h3>Annotated Source Code</h3> 514 <p>Press <a href="#" onclick="toggleHelp(); return false;">'?'</a> 515 to see keyboard shortcuts</p> 516 <input type="checkbox" class="spoilerhider" id="showinvocation" /> 517 <label for="showinvocation" >Show analyzer invocation</label> 518 <div class="spoiler">clang -cc1 )<<<"; 522 <div id='tooltiphint' hidden="true"> 523 <p>Keyboard shortcuts: </p> 525 <li>Use 'j/k' keys for keyboard navigation</li> 526 <li>Use 'Shift+S' to show/hide relevant lines</li> 527 <li>Use '?' to toggle this window</li> 529 <a href="#" onclick="toggleHelp(); return false;">Close</a> 538 llvm::raw_string_ostream os(s);
541 if (!BugDesc.empty())
542 os <<
"\n<!-- BUGDESC " << BugDesc <<
" -->\n";
545 if (!BugType.empty())
546 os <<
"\n<!-- BUGTYPE " << BugType <<
" -->\n";
556 if (!BugCategory.empty())
557 os <<
"\n<!-- BUGCATEGORY " << BugCategory <<
" -->\n";
559 os <<
"\n<!-- BUGFILE " << DirName << Entry->
getName() <<
" -->\n";
561 os <<
"\n<!-- FILENAME " << llvm::sys::path::filename(Entry->
getName()) <<
" -->\n";
563 os <<
"\n<!-- FUNCTIONNAME " << declName <<
" -->\n";
565 os <<
"\n<!-- ISSUEHASHCONTENTOFLINEINCONTEXT " 569 os <<
"\n<!-- BUGLINE " 573 os <<
"\n<!-- BUGCOLUMN " 577 os <<
"\n<!-- BUGPATHLENGTH " << path.size() <<
" -->\n";
580 os <<
"\n<!-- BUGMETAEND -->\n";
589 std::string HTMLDiagnostics::showHelpJavascript() {
591 <script type='text/javascript'> 593 var toggleHelp = function() { 594 var hint = document.querySelector("#tooltiphint"); 595 var attributeName = "hidden"; 596 if (hint.hasAttribute(attributeName)) { 597 hint.removeAttribute(attributeName); 599 hint.setAttribute("hidden", "true"); 602 window.addEventListener("keydown", function (event) { 603 if (event.defaultPrevented) { 606 if (event.key == "?") { 611 event.preventDefault(); 621 unsigned TotalPieces = path.size();
622 unsigned TotalNotePieces =
623 std::count_if(path.begin(), path.end(),
624 [](
const std::shared_ptr<PathDiagnosticPiece> &p) {
625 return isa<PathDiagnosticNotePiece>(*p);
628 unsigned TotalRegularPieces = TotalPieces - TotalNotePieces;
629 unsigned NumRegularPieces = TotalRegularPieces;
630 unsigned NumNotePieces = TotalNotePieces;
632 for (
auto I = path.rbegin(), E = path.rend(); I != E; ++I) {
633 if (isa<PathDiagnosticNotePiece>(I->get())) {
637 HandlePiece(R, FID, **I, NumNotePieces, TotalNotePieces);
640 HandlePiece(R, FID, **I, NumRegularPieces, TotalRegularPieces);
660 unsigned num,
unsigned max) {
669 assert(&Pos.
getManager() == &SM &&
"SourceManagers are different!");
672 if (LPosInfo.first != BugFileID)
675 const llvm::MemoryBuffer *Buf = SM.
getBuffer(LPosInfo.first);
676 const char* FileStart = Buf->getBufferStart();
682 const char *LineStart = TokInstantiationPtr-ColNo;
685 const char *LineEnd = TokInstantiationPtr;
686 const char* FileEnd = Buf->getBufferEnd();
687 while (*LineEnd !=
'\n' && LineEnd != FileEnd)
692 for (
const char* c = LineStart; c != TokInstantiationPtr; ++c)
693 PosNo += *c ==
'\t' ? 8 : 1;
697 const char *
Kind =
nullptr;
699 bool SuppressIndex = (max == 1);
702 llvm_unreachable(
"Calls and extra notes should already be handled");
710 SuppressIndex =
true;
715 llvm::raw_string_ostream os(sbuf);
717 os <<
"\n<tr><td class=\"num\"></td><td class=\"line\"><div id=\"";
726 os <<
"\" class=\"msg";
728 os <<
" msg" <<
Kind;
729 os <<
"\" style=\"margin-left:" << PosNo <<
"ex";
732 if (!isa<PathDiagnosticMacroPiece>(P)) {
735 unsigned max_token = 0;
737 unsigned len = Msg.size();
747 if (cnt > max_token) max_token = cnt;
756 const unsigned max_line = 120;
758 if (max_token >= max_line)
761 unsigned characters = max_line;
762 unsigned lines = len / max_line;
765 for (; characters > max_token; --characters)
766 if (len / characters > lines) {
776 os <<
"; max-width:" << em <<
"em";
779 os <<
"; max-width:100em";
783 if (!SuppressIndex) {
784 os <<
"<table class=\"msgT\"><tr><td valign=\"top\">";
785 os <<
"<div class=\"PathIndex";
786 if (Kind) os <<
" PathIndex" <<
Kind;
787 os <<
"\">" << num <<
"</div>";
790 os <<
"</td><td><div class=\"PathNav\"><a href=\"#Path" 792 <<
"\" title=\"Previous event (" 794 <<
")\">←</a></div></td>";
800 if (
const auto *MP = dyn_cast<PathDiagnosticMacroPiece>(&P)) {
801 os <<
"Within the expansion of the macro '";
809 const char* MacroName = LocInfo.second + BufferInfo.data();
811 BufferInfo.begin(), MacroName, BufferInfo.end());
814 rawLexer.LexFromRawLexer(TheTok);
815 for (
unsigned i = 0, n = TheTok.getLength(); i < n; ++i)
821 if (!SuppressIndex) {
824 os <<
"<td><div class=\"PathNav\"><a href=\"#";
828 os <<
"Path" << (num + 1);
829 os <<
"\" title=\"Next event (" 831 <<
")\">→</a></div></td>";
834 os <<
"</tr></table>";
838 ProcessMacroPiece(os, *MP, 0);
843 if (!SuppressIndex) {
846 os <<
"<td><div class=\"PathNav\"><a href=\"#";
850 os <<
"Path" << (num + 1);
851 os <<
"\" title=\"Next event (" 853 <<
")\">→</a></div></td>";
856 os <<
"</tr></table>";
860 os <<
"</div></td></tr>";
863 unsigned DisplayPos = LineEnd - FileStart;
871 for (
const auto &
Range : Ranges)
876 unsigned x = n % (
'z' -
'a');
885 unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream &os,
888 for (
const auto &subPiece : P.
subPieces) {
889 if (
const auto *MP = dyn_cast<PathDiagnosticMacroPiece>(subPiece.get())) {
890 num = ProcessMacroPiece(os, *MP, num);
894 if (
const auto *EP = dyn_cast<PathDiagnosticEventPiece>(subPiece.get())) {
895 os <<
"<div class=\"msg msgEvent\" style=\"width:94%; " 897 "<table class=\"msgT\"><tr>" 898 "<td valign=\"top\"><div class=\"PathIndex PathIndexEvent\">";
900 os <<
"</div></td><td valign=\"top\">" 902 <<
"</td></tr></table></div>\n";
911 const char *HighlightStart,
912 const char *HighlightEnd) {
922 if (EndLineNo < StartLineNo)
925 if (SM.
getFileID(InstantiationStart) != BugFileID ||
926 SM.
getFileID(InstantiationEnd) != BugFileID)
931 unsigned OldEndColNo = EndColNo;
947 std::string HTMLDiagnostics::generateKeyboardNavigationJavascript() {
949 <script type='text/javascript'> 950 var digitMatcher = new RegExp("[0-9]+"); 952 document.addEventListener("DOMContentLoaded", function() { 953 document.querySelectorAll(".PathNav > a").forEach( 954 function(currentValue, currentIndex) { 955 var hrefValue = currentValue.getAttribute("href"); 956 currentValue.onclick = function() { 957 scrollTo(document.querySelector(hrefValue)); 963 var findNum = function() { 964 var s = document.querySelector(".selected"); 965 if (!s || s.id == "EndPath") { 968 var out = parseInt(digitMatcher.exec(s.id)[0]); 972 var scrollTo = function(el) { 973 document.querySelectorAll(".selected").forEach(function(s) { 974 s.classList.remove("selected"); 976 el.classList.add("selected"); 977 window.scrollBy(0, el.getBoundingClientRect().top - 978 (window.innerHeight / 2)); 981 var move = function(num, up, numItems) { 982 if (num == 1 && up || num == numItems - 1 && !up) { 984 } else if (num == 0 && up) { 986 } else if (num == 0 && !up) { 989 return up ? num - 1 : num + 1; 992 var numToId = function(num) { 994 return document.getElementById("EndPath") 996 return document.getElementById("Path" + num); 999 var navigateTo = function(up) { 1000 var numItems = document.querySelectorAll(".line > .msg").length; 1001 var currentSelected = findNum(); 1002 var newSelected = move(currentSelected, up, numItems); 1003 var newEl = numToId(newSelected, numItems); 1005 // Scroll element into center. 1009 window.addEventListener("keydown", function (event) { 1010 if (event.defaultPrevented) { 1013 if (event.key == "j") { 1014 navigateTo(/*up=*/false); 1015 } else if (event.key == "k") { 1016 navigateTo(/*up=*/true); 1020 event.preventDefault(); SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
static void serializeExecutedLines(const PathDiagnostic &D, const PathPieces &path, llvm::raw_string_ostream &os)
Write executed lines from D in JSON format into os.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Lexer - This provides a simple interface that turns a text buffer into a stream of tokens...
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
SourceLocation getLocForEndOfFile(FileID FID) const
Return the source location corresponding to the last byte of the specified file.
Defines the clang::FileManager interface and associated types.
FullSourceLoc getExpansionLoc() const
Stmt - This represents one statement.
Defines the SourceManager interface.
Decl - This represents one declaration (or definition), e.g.
unsigned getColumnNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Return the column # for the specified file position.
A Range represents the closed range [from, to].
llvm::SmallString< 32 > GetIssueHash(const SourceManager &SM, FullSourceLoc &IssueLoc, llvm::StringRef CheckerName, llvm::StringRef BugType, const Decl *D, const LangOptions &LangOpts)
Get an MD5 hash to help identify bugs.
RewriteBuffer - As code is rewritten, SourceBuffer's from the original input with modifications get a...
meta_iterator meta_begin() const
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
PathDiagnosticLocation getLocation() const
PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diagnostic.
filesmap_iterator executedLines_begin() const
void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP)
HighlightMacros - This uses the macro table state from the end of the file, to reexpand macros and in...
void AddLineNumbers(Rewriter &R, FileID FID)
StringRef getVerboseDescription() const
unsigned getHashValue() const
Token - This structure provides full information about a lexed token.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
const LangOptions & getLangOpts() const
std::pair< FileID, unsigned > getDecomposedExpansionLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceManager & getSourceMgr() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
StringRef getBugType() const
meta_iterator meta_end() const
std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
void SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP)
SyntaxHighlight - Relex the specified FileID and annotate the HTML with information about keywords...
StringRef getCheckName() const
virtual PathDiagnosticLocation getLocation() const =0
bool shouldWriteStableReportFilename()
Returns whether or not the report filename should be random or not.
std::pair< FileID, unsigned > getDecomposedLoc() const
Decompose the specified location into a raw FileID + Offset pair.
static unsigned MeasureTokenLength(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
MeasureTokenLength - Relex the token at the specified location and return its length in bytes in the ...
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
static void EmitAlphaCounter(raw_ostream &os, unsigned n)
const char * getCharacterData(bool *Invalid=nullptr) const
unsigned getLineNumber(bool *Invalid=nullptr) const
Defines the clang::Preprocessor interface.
PathDiagnosticLocation getUniqueingLoc() const
Get the location on which the report should be uniqued.
const SourceManager & getManager() const
SourceLocation getEnd() const
unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
static void ReportDiag(raw_ostream &o, const PathDiagnosticPiece &P, const FIDMap &FM, const SourceManager &SM, const LangOptions &LangOpts)
PathPieces flatten(bool ShouldFlattenMacros) const
StringRef getCategory() const
llvm::MemoryBuffer * getBuffer(FileID FID, SourceLocation Loc, bool *Invalid=nullptr) const
Return the buffer for the specified FileID.
Encodes a location in the source.
StringRef getName() const
std::vector< PathDiagnosticConsumer * > PathDiagnosticConsumers
void EscapeText(Rewriter &R, FileID FID, bool EscapeSpaces=false, bool ReplaceTabs=false)
EscapeText - HTMLize a specified file so that special characters are are translated so that they are ...
bool InsertTextAfter(SourceLocation Loc, StringRef Str)
InsertTextAfter - Insert the specified string at the specified location in the original buffer...
Cached information about one file (either on disk or in the virtual file system). ...
std::deque< std::string >::const_iterator meta_iterator
const RewriteBuffer * getRewriteBufferFor(FileID FID) const
getRewriteBufferFor - Return the rewrite buffer for the specified FileID.
FullSourceLoc asLocation() const
StringRef getBufferData(bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
bool InsertTextBefore(SourceLocation Loc, StringRef Str)
InsertText - Insert the specified string at the specified location in the original buffer...
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
unsigned getExpansionColumnNumber(SourceLocation Loc, bool *Invalid=nullptr) const
ArrayRef< SourceRange > getRanges() const
Return the SourceRanges associated with this PathDiagnosticPiece.
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID, StringRef title)
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
static std::string showRelevantLinesJavascript(const PathDiagnostic &D, const PathPieces &path)
const LangOptions & getLangOpts() const
Rewriter - This is the main interface to the rewrite buffers.
Defines the clang::SourceLocation class and associated facilities.
void HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E, const char *StartTag, const char *EndTag, bool IsTokenRange=true)
HighlightRange - Highlight a range in the source code with the specified start/end tags...
A SourceLocation and its associated SourceManager.
__DEVICE__ int max(int __a, int __b)
A trivial tuple used to represent a source range.
StringRef getString() const
filesmap_iterator executedLines_end() const
SourceLocation getBegin() const
This class handles loading and caching of source files into memory.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
const Decl * getDeclWithIssue() const
Return the semantic context where an issue occurred.