33#include "llvm/ADT/ArrayRef.h"
34#include "llvm/ADT/FoldingSet.h"
35#include "llvm/ADT/STLExtras.h"
36#include "llvm/ADT/SmallString.h"
37#include "llvm/ADT/SmallVector.h"
38#include "llvm/ADT/StringExtras.h"
39#include "llvm/ADT/StringRef.h"
40#include "llvm/Support/Casting.h"
41#include "llvm/Support/ErrorHandling.h"
42#include "llvm/Support/raw_ostream.h"
60 : kind(k), Hint(hint) {}
77 bool ShouldFlattenMacros)
const {
78 for (
auto &Piece : *
this) {
79 switch (Piece->getKind()) {
81 auto &
Call = cast<PathDiagnosticCallPiece>(*Piece);
84 Call.path.flattenTo(Primary, Primary, ShouldFlattenMacros);
85 if (
auto callExit =
Call.getCallExitEvent())
86 Current.push_back(std::move(callExit));
90 auto &Macro = cast<PathDiagnosticMacroPiece>(*Piece);
91 if (ShouldFlattenMacros) {
92 Macro.subPieces.flattenTo(Primary, Primary, ShouldFlattenMacros);
94 Current.push_back(Piece);
96 Macro.subPieces.flattenTo(Primary, NewPath, ShouldFlattenMacros);
98 Macro.subPieces = NewPath;
106 Current.push_back(Piece);
115 StringRef CheckerName,
const Decl *declWithIssue, StringRef bugtype,
116 StringRef verboseDesc, StringRef shortDesc, StringRef category,
118 std::unique_ptr<FilesToLineNumsMap> ExecutedLines)
119 : CheckerName(CheckerName), DeclWithIssue(declWithIssue),
124 UniqueingDecl(DeclToUnique), ExecutedLines(
std::move(ExecutedLines)),
127void PathDiagnosticConsumer::anchor() {}
136 std::unique_ptr<PathDiagnostic> D) {
137 if (!D || D->path.empty())
143 D->flattenLocations();
150 const SourceManager &SMgr = D->path.front()->getLocation().getManager();
154 llvm::raw_svector_ostream warning(buf);
155 warning <<
"warning: Path diagnostic report is not generated. Current "
156 <<
"output format does not support diagnostics that cross file "
157 <<
"boundaries. Refer to --analyzer-output for valid output "
163 for (
const auto &I : path) {
170 llvm::errs() << warning.str();
176 for (
const auto &I : Ranges) {
179 llvm::errs() << warning.str();
184 llvm::errs() << warning.str();
189 if (
const auto *call = dyn_cast<PathDiagnosticCallPiece>(piece))
191 else if (
const auto *macro = dyn_cast<PathDiagnosticMacroPiece>(piece))
192 WorkList.push_back(¯o->subPieces);
201 llvm::FoldingSetNodeID profile;
203 void *InsertPos =
nullptr;
210 const unsigned orig_size = orig->full_size();
211 const unsigned new_size = D->full_size();
212 if (orig_size <= new_size)
215 assert(orig != D.get());
216 Diags.RemoveNode(orig);
220 Diags.InsertNode(D.release());
226static std::optional<bool>
253 if (X_CEWL != Y_CEWL)
275 if (
X.getRanges().size() != Y.
getRanges().size())
276 return X.getRanges().size() < Y.
getRanges().size();
280 for (
unsigned i = 0, n =
X.getRanges().size(); i < n; ++i) {
290 switch (
X.getKind()) {
293 cast<PathDiagnosticControlFlowPiece>(Y));
296 cast<PathDiagnosticMacroPiece>(Y));
299 cast<PathDiagnosticCallPiece>(Y));
305 llvm_unreachable(
"all cases handled");
310 if (
X.size() != Y.size())
311 return X.size() < Y.size();
313 PathPieces::const_iterator X_I =
X.begin(), X_end =
X.end();
314 PathPieces::const_iterator Y_I = Y.begin(), Y_end = Y.end();
316 for (; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I)
331 std::pair<bool, bool> InSameTU =
SM.isInTheSameTranslationUnit(XOffs, YOffs);
364 auto CompareDecls = [&XL](
const Decl *D1,
365 const Decl *D2) -> std::optional<bool> {
389 if (XE - XI != YE - YI)
390 return (XE - XI) < (YE - YI);
391 for ( ; XI != XE ; ++XI, ++YI) {
393 return (*XI) < (*YI);
405 std::vector<const PathDiagnostic *> BatchDiags;
406 for (
const auto &D :
Diags)
407 BatchDiags.push_back(&D);
413 assert(*
X != *Y &&
"PathDiagnostics not uniqued!");
416 assert(
compare(**Y, **
X) &&
"Not a total order!");
419 array_pod_sort(BatchDiags.begin(), BatchDiags.end(), Comp);
424 for (
const auto D : BatchDiags)
432 for (
auto It = Set.begin(); It != Set.end();)
437 StringRef ConsumerName,
439 llvm::FoldingSetNodeID NodeID;
446 Set.InsertNode(Entry, InsertPos);
450 char *FileName_cstr = (
char*) Alloc.Allocate(
FileName.size(), 1);
453 Entry->
files.push_back(std::make_pair(ConsumerName,
454 StringRef(FileName_cstr,
460 llvm::FoldingSetNodeID NodeID;
466 return &Entry->
files;
475 SourceLocation L = UseEndOfStatement ? S->getEndLoc() : S->getBeginLoc();
476 assert(!LAC.isNull() &&
477 "A valid LocationContext or AnalysisDeclContext should be passed to "
478 "PathDiagnosticLocation upon creation.");
508 L = UseEndOfStatement ?
Parent->getEndLoc() :
Parent->getBeginLoc();
547 if (
const Stmt *CallerBody = CallerInfo->
getBody())
566 llvm_unreachable(
"not yet implemented!");
569 llvm_unreachable(
"CFGElement kind should not be on callsite!");
572 llvm_unreachable(
"Unknown CFGElement kind");
585 assert(S &&
"Statement cannot be null");
594 if (
const auto *CS = dyn_cast<CompoundStmt>(S))
595 return createEndBrace(CS,
SM);
645 if (
const auto *CS = dyn_cast_or_null<CompoundStmt>(LC->
getDecl()->
getBody()))
646 if (!CS->body_empty()) {
664 const Stmt* S =
nullptr;
665 if (std::optional<BlockEdge> BE =
P.getAs<
BlockEdge>()) {
666 const CFGBlock *BSrc = BE->getSrc();
671 P.getLocationContext()->getDecl(), SMng);
680 "TerminatorCondition and is not the enrty block of the CFG");
682 P.getLocationContext()->getDecl(), SMng);
685 }
else if (std::optional<StmtPoint> SP =
P.getAs<
StmtPoint>()) {
689 }
else if (std::optional<PostInitializer> PIP =
P.getAs<
PostInitializer>()) {
692 }
else if (std::optional<PreImplicitCall> PIC =
P.getAs<
PreImplicitCall>()) {
694 }
else if (std::optional<PostImplicitCall> PIE =
697 }
else if (std::optional<CallEnter> CE =
P.getAs<
CallEnter>()) {
699 CE->getLocationContext(),
701 }
else if (std::optional<CallExitEnd> CEE =
P.getAs<
CallExitEnd>()) {
703 CEE->getLocationContext(),
706 if (
const ReturnStmt *RS = CEB->getReturnStmt())
708 CEB->getLocationContext());
710 CEB->getLocationContext()->getDecl()->getSourceRange().getEnd(), SMng);
711 }
else if (std::optional<BlockEntrance> BE =
P.getAs<
BlockEntrance>()) {
712 if (std::optional<CFGElement> BlockFront = BE->getFirstElement()) {
713 if (
auto StmtElt = BlockFront->getAs<
CFGStmt>()) {
717 NewAllocElt->getAllocatorExpr()->getBeginLoc(), SMng);
719 llvm_unreachable(
"Unexpected CFG element at front of block");
723 BE->getBlock()->getTerminatorStmt()->getBeginLoc(), SMng);
724 }
else if (std::optional<FunctionExitPoint> FE =
727 FE->getLocationContext());
729 llvm_unreachable(
"Unexpected ProgramPoint");
778 const Stmt *S = asStmt();
779 switch (S->getStmtClass()) {
782 case Stmt::DeclStmtClass: {
783 const auto *DS = cast<DeclStmt>(S);
784 if (DS->isSingleDecl()) {
787 DS->getSingleDecl()->getLocation());
793 case Stmt::IfStmtClass:
794 case Stmt::WhileStmtClass:
795 case Stmt::DoStmtClass:
796 case Stmt::ForStmtClass:
797 case Stmt::ChooseExprClass:
798 case Stmt::IndirectGotoStmtClass:
799 case Stmt::SwitchStmtClass:
800 case Stmt::BinaryConditionalOperatorClass:
801 case Stmt::ConditionalOperatorClass:
802 case Stmt::ObjCForCollectionStmtClass: {
813 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
814 return MD->getSourceRange();
815 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
816 if (
Stmt *Body = FD->getBody())
817 return Body->getSourceRange();
834 else if (K == DeclK) {
845std::shared_ptr<PathDiagnosticCallPiece>
852 return std::shared_ptr<PathDiagnosticCallPiece>(
858 const Decl *caller) {
859 std::shared_ptr<PathDiagnosticCallPiece>
C(
863 path.push_front(std::move(
C));
881 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(Callee))
882 IsCalleeAnAutosynthesizedPropertyAccessor = (
883 MD->isPropertyAccessor() &&
890 StringRef Prefix = StringRef(),
891 StringRef Postfix = StringRef());
907 StringRef Prefix, StringRef Postfix) {
912 for (
int I = 0,
Last = TAList.size() - 1; I !=
Last; ++I) {
921 StringRef Prefix = StringRef()) {
924 Out << Prefix <<
'\'' << *D;
925 if (
const auto T = dyn_cast<ClassTemplateSpecializationDecl>(D))
927 D->getLangOpts(),
"<",
">");
933 bool ExtendedDescription,
934 StringRef Prefix = StringRef()) {
938 if (isa<BlockDecl>(D)) {
939 if (ExtendedDescription)
940 Out << Prefix <<
"anonymous block";
941 return ExtendedDescription;
944 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
946 if (ExtendedDescription && !MD->isUserProvided()) {
947 if (MD->isExplicitlyDefaulted())
953 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(MD)) {
954 if (CD->isDefaultConstructor())
956 else if (CD->isCopyConstructor())
958 else if (CD->isMoveConstructor())
961 Out <<
"constructor";
963 }
else if (isa<CXXDestructorDecl>(MD)) {
964 if (!MD->isUserProvided()) {
969 Out <<
"'" << *MD <<
"'";
971 }
else if (MD->isCopyAssignmentOperator()) {
972 Out <<
"copy assignment operator";
974 }
else if (MD->isMoveAssignmentOperator()) {
975 Out <<
"move assignment operator";
978 if (MD->getParent()->getIdentifier())
979 Out <<
"'" << *MD->getParent() <<
"::" << *MD <<
"'";
981 Out <<
"'" << *MD <<
"'";
987 Out << Prefix << '\'' << cast<NamedDecl>(*D);
990 if (
const auto FD = dyn_cast<FunctionDecl>(D))
992 FD->getTemplateSpecializationArgs())
1000std::shared_ptr<PathDiagnosticEventPiece>
1006 if (!Callee || IsCalleeAnAutosynthesizedPropertyAccessor)
1010 llvm::raw_svector_ostream Out(buf);
1015 assert(callEnter.asLocation().isValid());
1016 return std::make_shared<PathDiagnosticEventPiece>(callEnter, Out.str());
1019std::shared_ptr<PathDiagnosticEventPiece>
1021 if (!callEnterWithin.asLocation().isValid())
1023 if (Callee->isImplicit() || !Callee->hasBody())
1025 if (
const auto *MD = dyn_cast<CXXMethodDecl>(Callee))
1026 if (MD->isDefaulted())
1030 llvm::raw_svector_ostream Out(buf);
1032 Out <<
"Entered call";
1035 return std::make_shared<PathDiagnosticEventPiece>(callEnterWithin, Out.str());
1038std::shared_ptr<PathDiagnosticEventPiece>
1044 if (NoExit || IsCalleeAnAutosynthesizedPropertyAccessor)
1048 llvm::raw_svector_ostream Out(buf);
1050 if (!CallStackMessage.empty()) {
1051 Out << CallStackMessage;
1057 Out <<
"Returning to caller";
1060 assert(callReturn.asLocation().isValid());
1061 return std::make_shared<PathDiagnosticEventPiece>(callReturn, Out.str());
1065 for (
const auto &I : pieces) {
1067 if (
const auto *cp = dyn_cast<PathDiagnosticCallPiece>(piece))
1085 ID.Add(
Range.getBegin());
1086 ID.Add(
Range.getEnd());
1091 ID.AddInteger((
unsigned)
getKind());
1094 ID.AddInteger((
unsigned) getDisplayHint());
1096 for (
const auto &I : Ranges) {
1097 ID.Add(I.getBegin());
1104 for (
const auto &I : path)
1115 for (
const auto &I : *
this)
1121 for (
const auto &I : subPieces)
1134 ID.Add(getLocation());
1135 ID.Add(getUniqueingLoc());
1137 ID.AddString(VerboseDesc);
1143 for (
const auto &I : path)
1145 for (
meta_iterator I = meta_begin(), E = meta_end(); I != E; ++I)
1151 for (PathPieces::const_iterator I = begin(), E = end(); I != E; ++I) {
1152 llvm::errs() <<
"[" << index++ <<
"] ";
1154 llvm::errs() <<
"\n";
1159 llvm::errs() <<
"CALL\n--------------\n";
1161 if (
const Stmt *SLoc = getLocation().getStmtOrNull())
1163 else if (
const auto *ND = dyn_cast_or_null<NamedDecl>(getCallee()))
1164 llvm::errs() << *ND <<
"\n";
1166 getLocation().dump();
1170 llvm::errs() <<
"EVENT\n--------------\n";
1171 llvm::errs() << getString() <<
"\n";
1172 llvm::errs() <<
" ---- at ----\n";
1173 getLocation().dump();
1177 llvm::errs() <<
"CONTROL\n--------------\n";
1178 getStartLocation().dump();
1179 llvm::errs() <<
" ---- to ----\n";
1180 getEndLocation().dump();
1184 llvm::errs() <<
"MACRO\n--------------\n";
1189 llvm::errs() <<
"NOTE\n--------------\n";
1190 llvm::errs() << getString() <<
"\n";
1191 llvm::errs() <<
" ---- at ----\n";
1192 getLocation().dump();
1196 llvm::errs() <<
"POP-UP\n--------------\n";
1197 llvm::errs() << getString() <<
"\n";
1198 llvm::errs() <<
" ---- at ----\n";
1199 getLocation().dump();
1204 llvm::errs() <<
"<INVALID>\n";
1211 llvm::errs() <<
"<range>\n";
1214 asLocation().dump();
1215 llvm::errs() <<
"\n";
1221 llvm::errs() <<
"<NULL STMT>\n";
1224 if (
const auto *ND = dyn_cast_or_null<NamedDecl>(D))
1225 llvm::errs() << *ND <<
"\n";
1226 else if (isa<BlockDecl>(D))
1228 llvm::errs() <<
"<block>\n";
1230 llvm::errs() <<
"<unknown decl>\n";
1232 llvm::errs() <<
"<NULL DECL>\n";
This file defines AnalysisDeclContext, a class that manages the analysis context data for context sen...
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
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.
static std::optional< bool > comparePath(const PathPieces &X, const PathPieces &Y)
static PathDiagnosticLocation getLocationForCaller(const StackFrameContext *SFC, const LocationContext *CallerCtx, const SourceManager &SM)
static void describeClass(raw_ostream &Out, const CXXRecordDecl *D, StringRef Prefix=StringRef())
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
static bool describeCodeDecl(raw_ostream &Out, const Decl *D, bool ExtendedDescription, StringRef Prefix=StringRef())
static std::optional< bool > compareCall(const PathDiagnosticCallPiece &X, const PathDiagnosticCallPiece &Y)
static std::optional< bool > comparePiece(const PathDiagnosticPiece &X, const PathDiagnosticPiece &Y)
static void describeTemplateParameter(raw_ostream &Out, const TemplateArgument &TArg, const LangOptions &LO)
static void compute_path_size(const PathPieces &pieces, unsigned &size)
static std::optional< bool > compareMacro(const PathDiagnosticMacroPiece &X, const PathDiagnosticMacroPiece &Y)
static std::optional< bool > compareControlFlow(const PathDiagnosticControlFlowPiece &X, const PathDiagnosticControlFlowPiece &Y)
static StringRef StripTrailingDots(StringRef s)
static void describeTemplateParameters(raw_ostream &Out, const ArrayRef< TemplateArgument > TAList, const LangOptions &LO, StringRef Prefix=StringRef(), StringRef Postfix=StringRef())
static bool compareCrossTUSourceLocs(FullSourceLoc XL, FullSourceLoc YL)
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
C Language Family Type Representation.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
__device__ __2f16 float __ockl_bool s
SourceLocation getColonLoc() const
AnalysisDeclContext contains the context data for the function, method or block under analysis.
ParentMap & getParentMap()
const Decl * getDecl() const
bool isBodyAutosynthesized() const
A builtin binary operation expression such as "x + y" or "x <= y".
SourceLocation getOperatorLoc() const
Represents C++ object destructor implicitly generated for automatic object or temporary bound to cons...
const Stmt * getTriggerStmt() const
Represents a single basic block in a source-level CFG.
CFGTerminator getTerminator() const
Stmt * getTerminatorCondition(bool StripParens=true)
Represents C++ object destructor generated from a call to delete.
const CXXDeleteExpr * getDeleteExpr() const
Represents a top-level expression in a basic block.
T castAs() const
Convert to the specified CFGElement type, asserting that this CFGElement is of the desired type.
Represents C++ base or member initializer from constructor's initialization list.
Represents C++ allocator call.
const CXXNewExpr * getAllocatorExpr() const
const Stmt * getStmt() const
Represents C++ object destructor implicitly generated at the end of full expression for temporary obj...
bool isVirtualBaseBranch() const
Represents a C++ struct/union/class.
Represents a point when we begin processing an inlined call.
const StackFrameContext * getCalleeContext() const
Represents a point when we start the call exit sequence (for inlined call).
Represents a point when we finish the call exit sequence (for inlined call).
const StackFrameContext * getCalleeContext() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
SourceLocation getLBracLoc() const
SourceLocation getRBracLoc() const
ConditionalOperator - The ?: ternary operator.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
SourceLocation getBodyRBrace() const
getBodyRBrace - Gets the right brace of the body, if a body exists.
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
StringRef getName() const
The name of this FileEntry.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A SourceLocation and its associated SourceManager.
FullSourceLoc getExpansionLoc() const
FullSourceLoc getSpellingLoc() const
std::pair< FileID, unsigned > getDecomposedLoc() const
Decompose the specified location into a raw FileID + Offset pair.
const SourceManager & getManager() const
bool isBeforeInTranslationUnitThan(SourceLocation Loc) const
Determines the order of 2 source locations in the translation unit.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
const Decl * getDecl() const
LLVM_ATTRIBUTE_RETURNS_NONNULL AnalysisDeclContext * getAnalysisDeclContext() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
SourceLocation getBeginLoc() const LLVM_READONLY
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Represents a program point just after an implicit call event.
Represents a point after we ran remove dead bindings AFTER processing the given statement.
Represents a program point just before an implicit call event.
const LocationContext * getLocationContext() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
It represents a stack frame of the call stack (based on CallEvent).
unsigned getIndex() const
const CFGBlock * getCallSiteBlock() const
Stmt - This represents one statement.
SourceLocation getBeginLoc() const LLVM_READONLY
A template argument list.
Represents a template argument.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
void print(const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const
Print this template argument to the given output stream.
@ Pack
The template argument is actually a parameter pack.
ArgKind getKind() const
Return the kind of stored template argument.
~PathDiagnosticCallPiece() override
void setCallee(const CallEnter &CE, const SourceManager &SM)
PathDiagnosticLocation callEnter
void dump() const override
std::shared_ptr< PathDiagnosticEventPiece > getCallExitEvent() const
static std::shared_ptr< PathDiagnosticCallPiece > construct(const CallExitEnd &CE, const SourceManager &SM)
PathDiagnosticLocation callReturn
std::shared_ptr< PathDiagnosticEventPiece > getCallEnterWithinCallerEvent() const
void Profile(llvm::FoldingSetNodeID &ID) const override
std::shared_ptr< PathDiagnosticEventPiece > getCallEnterEvent() const
PathDiagnosticLocation callEnterWithin
PDFileEntry::ConsumerFiles * getFiles(const PathDiagnostic &PD)
void addDiagnostic(const PathDiagnostic &PD, StringRef ConsumerName, StringRef fileName)
std::vector< std::pair< StringRef, StringRef > > ConsumerFiles
ConsumerFiles files
A vector of <consumer,file> pairs.
virtual void FlushDiagnosticsImpl(std::vector< const PathDiagnostic * > &Diags, FilesMade *filesMade)=0
virtual bool supportsCrossFileDiagnostics() const
Return true if the PathDiagnosticConsumer supports individual PathDiagnostics that span multiple file...
void HandlePathDiagnostic(std::unique_ptr< PathDiagnostic > D)
llvm::FoldingSet< PathDiagnostic > Diags
virtual ~PathDiagnosticConsumer()
void FlushDiagnostics(FilesMade *FilesMade)
PathDiagnosticLocation getStartLocation() const
void dump() const override
~PathDiagnosticControlFlowPiece() override
PathDiagnosticLocation getEndLocation() const
void Profile(llvm::FoldingSetNodeID &ID) const override
~PathDiagnosticEventPiece() override
void dump() const override
static PathDiagnosticLocation createMemberLoc(const MemberExpr *ME, const SourceManager &SM)
For member expressions, return the location of the '.
static PathDiagnosticLocation createDeclBegin(const LocationContext *LC, const SourceManager &SM)
Create a location for the beginning of the enclosing declaration body.
void Profile(llvm::FoldingSetNodeID &ID) const
static PathDiagnosticLocation createOperatorLoc(const BinaryOperator *BO, const SourceManager &SM)
Create the location for the operator of the binary expression.
static PathDiagnosticLocation createEndBrace(const CompoundStmt *CS, const SourceManager &SM)
Create a location for the end of the compound statement.
static PathDiagnosticLocation createBeginBrace(const CompoundStmt *CS, const SourceManager &SM)
Create a location for the beginning of the compound statement.
static SourceLocation getValidSourceLocation(const Stmt *S, LocationOrAnalysisDeclContext LAC, bool UseEndOfStatement=false)
Construct a source location that corresponds to either the beginning or the end of the given statemen...
static PathDiagnosticLocation createEnd(const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC)
Create a location for the end of the statement.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
FullSourceLoc asLocation() const
static PathDiagnosticLocation create(const Decl *D, const SourceManager &SM)
Create a location corresponding to the given declaration.
static PathDiagnosticLocation createConditionalColonLoc(const ConditionalOperator *CO, const SourceManager &SM)
static PathDiagnosticLocation createDeclEnd(const LocationContext *LC, const SourceManager &SM)
Constructs a location for the end of the enclosing declaration body.
static PathDiagnosticLocation createSingleLocation(const PathDiagnosticLocation &PDL)
Convert the given location into a single kind location.
void dump() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
~PathDiagnosticMacroPiece() override
void Profile(llvm::FoldingSetNodeID &ID) const override
void dump() const override
~PathDiagnosticNotePiece() override
ArrayRef< SourceRange > getRanges() const
Return the SourceRanges associated with this PathDiagnosticPiece.
virtual PathDiagnosticLocation getLocation() const =0
virtual void Profile(llvm::FoldingSetNodeID &ID) const
virtual ~PathDiagnosticPiece()
PathDiagnosticPiece()=delete
StringRef getString() const
void Profile(llvm::FoldingSetNodeID &ID) const override
PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diagnostic.
meta_iterator meta_end() const
void FullProfile(llvm::FoldingSetNodeID &ID) const
Profiles the diagnostic, including its path.
PathDiagnosticLocation getUniqueingLoc() const
Get the location on which the report should be uniqued.
std::deque< std::string >::const_iterator meta_iterator
StringRef getVerboseDescription() const
const Decl * getDeclWithIssue() const
Return the semantic context where an issue occurred.
void Profile(llvm::FoldingSetNodeID &ID) const
Profiles the diagnostic, independent of the path it references.
unsigned full_size()
Return the unrolled size of the path.
StringRef getBugType() const
const Decl * getUniqueingDecl() const
Get the declaration containing the uniqueing location.
StringRef getCategory() const
StringRef getShortDescription() const
meta_iterator meta_begin() const
PathDiagnosticLocation getLocation() const
A Range represents the closed range [from, to].
llvm::PointerUnion< const LocationContext *, AnalysisDeclContext * > LocationOrAnalysisDeclContext
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
Describes how types, statements, expressions, and declarations should be printed.