clang 20.0.0git
|
#include "clang/Frontend/DiagnosticRenderer.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Edit/Commit.h"
#include "clang/Edit/EditedSource.h"
#include "clang/Edit/EditsReceiver.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <utility>
Go to the source code of this file.
Functions | |
static void | mergeFixits (ArrayRef< FixItHint > FixItHints, const SourceManager &SM, const LangOptions &LangOpts, SmallVectorImpl< FixItHint > &MergedFixits) |
static SourceLocation | retrieveMacroLocation (SourceLocation Loc, FileID MacroFileID, FileID CaretFileID, const SmallVectorImpl< FileID > &CommonArgExpansions, bool IsBegin, const SourceManager *SM, bool &IsTokenRange) |
A recursive function to trace all possible backtrace locations to match the CaretLocFileID . | |
static void | getMacroArgExpansionFileIDs (SourceLocation Loc, SmallVectorImpl< FileID > &IDs, bool IsBegin, const SourceManager *SM) |
Walk up the chain of macro expansions and collect the FileIDs identifying the expansions. | |
static void | computeCommonMacroArgExpansionFileIDs (SourceLocation Begin, SourceLocation End, const SourceManager *SM, SmallVectorImpl< FileID > &CommonArgExpansions) |
Collect the expansions of the begin and end locations and compute the set intersection. | |
static void | mapDiagnosticRanges (FullSourceLoc CaretLoc, ArrayRef< CharSourceRange > Ranges, SmallVectorImpl< CharSourceRange > &SpellingRanges) |
static bool | checkLocForMacroArgExpansion (SourceLocation Loc, const SourceManager &SM, SourceLocation ArgumentLoc) |
Check that the macro argument location of Loc starts with ArgumentLoc. | |
static bool | checkRangeForMacroArgExpansion (CharSourceRange Range, const SourceManager &SM, SourceLocation ArgumentLoc) |
Check if all the locations in the range have the same macro argument expansion, and that the expansion starts with ArgumentLoc. | |
static bool | checkRangesForMacroArgExpansion (FullSourceLoc Loc, ArrayRef< CharSourceRange > Ranges) |
A helper function to check if the current ranges are all inside the same macro argument expansion as Loc. | |
|
static |
Check that the macro argument location of Loc starts with ArgumentLoc.
The starting location of the macro expansions is used to differeniate different macro expansions.
Definition at line 460 of file DiagnosticRenderer.cpp.
Referenced by checkRangeForMacroArgExpansion().
|
static |
Check if all the locations in the range have the same macro argument expansion, and that the expansion starts with ArgumentLoc.
Definition at line 473 of file DiagnosticRenderer.cpp.
References checkLocForMacroArgExpansion(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::SourceLocation::getLocWithOffset(), Range, and SM.
Referenced by checkRangesForMacroArgExpansion().
|
static |
A helper function to check if the current ranges are all inside the same macro argument expansion as Loc.
Definition at line 488 of file DiagnosticRenderer.cpp.
References checkRangeForMacroArgExpansion(), clang::SourceLocation::isMacroID(), Loc, mapDiagnosticRanges(), and Range.
|
static |
Collect the expansions of the begin and end locations and compute the set intersection.
Produces a sorted vector of FileIDs in CommonArgExpansions.
Definition at line 330 of file DiagnosticRenderer.cpp.
References Begin, getMacroArgExpansionFileIDs(), and SM.
Referenced by mapDiagnosticRanges().
|
static |
Walk up the chain of macro expansions and collect the FileIDs identifying the expansions.
Definition at line 314 of file DiagnosticRenderer.cpp.
References clang::SourceLocation::isMacroID(), Loc, and SM.
Referenced by computeCommonMacroArgExpansionFileIDs().
|
static |
Definition at line 355 of file DiagnosticRenderer.cpp.
References Begin, computeCommonMacroArgExpansionFileIDs(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::FullSourceLoc::getFileID(), clang::FullSourceLoc::getManager(), clang::SourceLocation::isInvalid(), clang::SourceRange::isInvalid(), clang::SourceLocation::isMacroID(), Range, retrieveMacroLocation(), and SM.
Referenced by checkRangesForMacroArgExpansion().
|
static |
Definition at line 58 of file DiagnosticRenderer.cpp.
References clang::edit::EditedSource::applyRewrites(), clang::edit::EditedSource::commit(), clang::edit::Commit::insert(), clang::edit::Commit::insertFromRange(), clang::edit::Commit::remove(), clang::edit::Commit::replace(), and SM.
Referenced by clang::DiagnosticRenderer::emitDiagnostic().
|
static |
A recursive function to trace all possible backtrace locations to match the CaretLocFileID
.
Definition at line 259 of file DiagnosticRenderer.cpp.
References clang::CharSourceRange::getBegin(), clang::CharSourceRange::getEnd(), clang::SourceLocation::isMacroID(), clang::CharSourceRange::isTokenRange(), clang::SourceLocation::isValid(), Loc, retrieveMacroLocation(), and SM.
Referenced by mapDiagnosticRanges(), and retrieveMacroLocation().