32 #include "llvm/ADT/ArrayRef.h" 33 #include "llvm/ADT/FoldingSet.h" 34 #include "llvm/ADT/None.h" 35 #include "llvm/ADT/Optional.h" 36 #include "llvm/ADT/STLExtras.h" 37 #include "llvm/ADT/SmallString.h" 38 #include "llvm/ADT/SmallVector.h" 39 #include "llvm/ADT/StringExtras.h" 40 #include "llvm/ADT/StringRef.h" 41 #include "llvm/Support/Casting.h" 42 #include "llvm/Support/ErrorHandling.h" 43 #include "llvm/Support/raw_ostream.h" 50 using namespace clang;
54 for (StringRef::size_type i = s.size(); i != 0; --i)
56 return s.substr(0, i);
65 : kind(k), Hint(hint) {}
82 bool ShouldFlattenMacros)
const {
83 for (
auto &Piece : *
this) {
84 switch (Piece->getKind()) {
86 auto &
Call = cast<PathDiagnosticCallPiece>(*Piece);
89 Call.path.flattenTo(Primary, Primary, ShouldFlattenMacros);
90 if (
auto callExit =
Call.getCallExitEvent())
91 Current.push_back(std::move(callExit));
95 auto &
Macro = cast<PathDiagnosticMacroPiece>(*Piece);
96 if (ShouldFlattenMacros) {
97 Macro.subPieces.flattenTo(Primary, Primary, ShouldFlattenMacros);
99 Current.push_back(Piece);
101 Macro.subPieces.flattenTo(Primary, NewPath, ShouldFlattenMacros);
103 Macro.subPieces = NewPath;
111 Current.push_back(Piece);
120 StringRef CheckerName,
const Decl *declWithIssue, StringRef bugtype,
121 StringRef verboseDesc, StringRef shortDesc, StringRef category,
123 std::unique_ptr<FilesToLineNumsMap> ExecutedLines)
124 : CheckerName(CheckerName), DeclWithIssue(declWithIssue),
129 UniqueingDecl(DeclToUnique), ExecutedLines(
std::move(ExecutedLines)),
132 void PathDiagnosticConsumer::anchor() {}
136 for (
auto &
Diag : Diags)
141 std::unique_ptr<PathDiagnostic> D) {
142 if (!D || D->path.empty())
148 D->flattenLocations();
152 if (!supportsCrossFileDiagnostics()) {
155 const SourceManager &SMgr = D->path.front()->getLocation().getManager();
157 WorkList.push_back(&D->path);
159 llvm::raw_svector_ostream warning(buf);
160 warning <<
"warning: Path diagnostic report is not generated. Current " 161 <<
"output format does not support diagnostics that cross file " 162 <<
"boundaries. Refer to --analyzer-output for valid output " 165 while (!WorkList.empty()) {
168 for (
const auto &I : path) {
175 llvm::errs() << warning.str();
181 for (
const auto &I : Ranges) {
184 llvm::errs() << warning.str();
189 llvm::errs() << warning.str();
194 if (
const auto *call = dyn_cast<PathDiagnosticCallPiece>(piece))
195 WorkList.push_back(&call->path);
196 else if (
const auto *macro = dyn_cast<PathDiagnosticMacroPiece>(piece))
197 WorkList.push_back(¯o->subPieces);
206 llvm::FoldingSetNodeID profile;
208 void *InsertPos =
nullptr;
210 if (
PathDiagnostic *orig = Diags.FindNodeOrInsertPos(profile, InsertPos)) {
215 const unsigned orig_size = orig->full_size();
216 const unsigned new_size = D->full_size();
217 if (orig_size <= new_size)
220 assert(orig != D.get());
221 Diags.RemoveNode(orig);
225 Diags.InsertNode(D.release());
257 if (X_CEWL != Y_CEWL)
284 for (
unsigned i = 0, n = X.
getRanges().size(); i < n; ++i) {
297 cast<PathDiagnosticControlFlowPiece>(Y));
300 cast<PathDiagnosticMacroPiece>(Y));
302 return compareCall(cast<PathDiagnosticCallPiece>(X),
303 cast<PathDiagnosticCallPiece>(Y));
309 llvm_unreachable(
"all cases handled");
313 if (X.size() != Y.size())
314 return X.size() < Y.size();
316 PathPieces::const_iterator X_I = X.begin(), X_end = X.end();
317 PathPieces::const_iterator Y_I = Y.begin(), Y_end = Y.end();
319 for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {
341 return NameCmp == -1;
376 if (XE - XI != YE - YI)
377 return (XE - XI) < (YE - YI);
378 for ( ; XI != XE ; ++XI, ++YI) {
380 return (*XI) < (*YI);
383 assert(b.hasValue());
394 std::vector<const PathDiagnostic *> BatchDiags;
395 for (
const auto &D : Diags)
396 BatchDiags.push_back(&D);
402 assert(*X != *Y &&
"PathDiagnostics not uniqued!");
405 assert(
compare(**Y, **X) &&
"Not a total order!");
408 array_pod_sort(BatchDiags.begin(), BatchDiags.end(), Comp);
410 FlushDiagnosticsImpl(BatchDiags, Files);
413 for (
const auto D : BatchDiags)
422 Entry.~PDFileEntry();
426 StringRef ConsumerName,
427 StringRef FileName) {
428 llvm::FoldingSetNodeID NodeID;
431 PDFileEntry *Entry = Set.FindNodeOrInsertPos(NodeID, InsertPos);
435 Set.InsertNode(Entry, InsertPos);
439 char *FileName_cstr = (
char*) Alloc.Allocate(FileName.size(), 1);
440 memcpy(FileName_cstr, FileName.data(), FileName.size());
442 Entry->
files.push_back(std::make_pair(ConsumerName,
443 StringRef(FileName_cstr,
449 llvm::FoldingSetNodeID NodeID;
452 PDFileEntry *Entry = Set.FindNodeOrInsertPos(NodeID, InsertPos);
455 return &Entry->
files;
465 assert(!LAC.isNull() &&
466 "A valid LocationContext or AnalysisDeclContext should be passed to " 467 "PathDiagnosticLocation upon creation.");
482 Parent = PM.getParent(Parent);
536 if (
const Stmt *CallerBody = CallerInfo->
getBody())
554 llvm_unreachable(
"not yet implemented!");
557 llvm_unreachable(
"CFGElement kind should not be on callsite!");
560 llvm_unreachable(
"Unknown CFGElement kind");
581 if (
const auto *CS = dyn_cast<CompoundStmt>(S))
582 return createEndBrace(CS, SM);
632 if (
const auto *CS = dyn_cast_or_null<CompoundStmt>(LC->
getDecl()->
getBody()))
633 if (!CS->body_empty()) {
651 const Stmt* S =
nullptr;
653 const CFGBlock *BSrc = BE->getSrc();
667 "TerminatorCondition and is not the enrty block of the CFG");
685 CE->getLocationContext(),
689 CEE->getLocationContext(),
692 if (
const ReturnStmt *RS = CEB->getReturnStmt())
694 CEB->getLocationContext());
696 CEB->getLocationContext()->getDecl()->getSourceRange().getEnd(), SMng);
699 if (
auto StmtElt = BlockFront->getAs<
CFGStmt>()) {
703 NewAllocElt->getAllocatorExpr()->getBeginLoc(), SMng);
705 llvm_unreachable(
"Unexpected CFG element at front of block");
709 BE->getBlock()->getTerminatorStmt()->getBeginLoc(), SMng);
712 FE->getLocationContext());
714 llvm_unreachable(
"Unexpected ProgramPoint");
741 const_cast<SourceManager&>(*
SM));
763 const Stmt *S = asStmt();
767 case Stmt::DeclStmtClass: {
768 const auto *DS = cast<DeclStmt>(S);
769 if (DS->isSingleDecl()) {
772 DS->getSingleDecl()->getLocation());
778 case Stmt::IfStmtClass:
779 case Stmt::WhileStmtClass:
780 case Stmt::DoStmtClass:
781 case Stmt::ForStmtClass:
782 case Stmt::ChooseExprClass:
783 case Stmt::IndirectGotoStmtClass:
784 case Stmt::SwitchStmtClass:
785 case Stmt::BinaryConditionalOperatorClass:
786 case Stmt::ConditionalOperatorClass:
787 case Stmt::ObjCForCollectionStmtClass: {
798 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
799 return MD->getSourceRange();
800 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
801 if (
Stmt *Body = FD->getBody())
802 return Body->getSourceRange();
819 else if (K == DeclK) {
830 std::shared_ptr<PathDiagnosticCallPiece>
837 return std::shared_ptr<PathDiagnosticCallPiece>(
843 const Decl *caller) {
844 std::shared_ptr<PathDiagnosticCallPiece> C(
848 path.push_front(std::move(C));
866 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(Callee))
867 IsCalleeAnAutosynthesizedPropertyAccessor = (
868 MD->isPropertyAccessor() &&
875 StringRef Prefix = StringRef(),
876 StringRef Postfix = StringRef());
882 if (TArg.
getKind() == TemplateArgument::ArgKind::Pack) {
890 const ArrayRef<TemplateArgument> TAList,
892 StringRef Prefix, StringRef Postfix) {
897 for (
int I = 0,
Last = TAList.size() - 1; I !=
Last; ++I) {
906 StringRef Prefix = StringRef()) {
909 Out << Prefix <<
'\'' << *D;
910 if (
const auto T = dyn_cast<ClassTemplateSpecializationDecl>(D))
912 D->getASTContext().getLangOpts(),
"<",
">");
918 bool ExtendedDescription,
919 StringRef Prefix = StringRef()) {
923 if (isa<BlockDecl>(D)) {
924 if (ExtendedDescription)
925 Out << Prefix <<
"anonymous block";
926 return ExtendedDescription;
929 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
931 if (ExtendedDescription && !MD->isUserProvided()) {
932 if (MD->isExplicitlyDefaulted())
938 if (
const auto *CD = dyn_cast<CXXConstructorDecl>(MD)) {
939 if (CD->isDefaultConstructor())
941 else if (CD->isCopyConstructor())
943 else if (CD->isMoveConstructor())
946 Out <<
"constructor";
948 }
else if (isa<CXXDestructorDecl>(MD)) {
949 if (!MD->isUserProvided()) {
954 Out <<
"'" << *MD <<
"'";
956 }
else if (MD->isCopyAssignmentOperator()) {
957 Out <<
"copy assignment operator";
959 }
else if (MD->isMoveAssignmentOperator()) {
960 Out <<
"move assignment operator";
963 if (MD->getParent()->getIdentifier())
964 Out <<
"'" << *MD->getParent() <<
"::" << *MD <<
"'";
966 Out <<
"'" << *MD <<
"'";
972 Out << Prefix << '\'' << cast<NamedDecl>(*D);
975 if (
const auto FD = dyn_cast<FunctionDecl>(D))
977 FD->getTemplateSpecializationArgs())
979 FD->getASTContext().getLangOpts(),
"<",
">");
985 std::shared_ptr<PathDiagnosticEventPiece>
991 if (!Callee || IsCalleeAnAutosynthesizedPropertyAccessor)
995 llvm::raw_svector_ostream Out(buf);
1000 assert(callEnter.asLocation().isValid());
1001 return std::make_shared<PathDiagnosticEventPiece>(callEnter, Out.str());
1004 std::shared_ptr<PathDiagnosticEventPiece>
1006 if (!callEnterWithin.asLocation().isValid())
1008 if (Callee->isImplicit() || !Callee->hasBody())
1010 if (
const auto *MD = dyn_cast<CXXMethodDecl>(Callee))
1011 if (MD->isDefaulted())
1015 llvm::raw_svector_ostream Out(buf);
1017 Out <<
"Entered call";
1020 return std::make_shared<PathDiagnosticEventPiece>(callEnterWithin, Out.str());
1023 std::shared_ptr<PathDiagnosticEventPiece>
1029 if (NoExit || IsCalleeAnAutosynthesizedPropertyAccessor)
1033 llvm::raw_svector_ostream Out(buf);
1035 if (!CallStackMessage.empty()) {
1036 Out << CallStackMessage;
1042 Out <<
"Returning to caller";
1045 assert(callReturn.asLocation().isValid());
1046 return std::make_shared<PathDiagnosticEventPiece>(callReturn, Out.str());
1050 for (
const auto &I : pieces) {
1052 if (
const auto *cp = dyn_cast<PathDiagnosticCallPiece>(piece))
1070 ID.AddInteger(
Range.getBegin().getRawEncoding());
1071 ID.AddInteger(
Range.getEnd().getRawEncoding());
1072 ID.AddInteger(
Loc.getRawEncoding());
1076 ID.AddInteger((
unsigned)
getKind());
1079 ID.AddInteger((
unsigned) getDisplayHint());
1081 for (
const auto &I : Ranges) {
1082 ID.AddInteger(I.getBegin().getRawEncoding());
1083 ID.AddInteger(I.getEnd().getRawEncoding());
1089 for (
const auto &I :
path)
1100 for (
const auto &I : *
this)
1106 for (
const auto &I : subPieces)
1121 ID.AddString(VerboseDesc);
1122 ID.AddString(Category);
1127 for (
const auto &I :
path)
1135 for (PathPieces::const_iterator I = begin(), E = end(); I != E; ++I) {
1136 llvm::errs() <<
"[" << index++ <<
"] ";
1138 llvm::errs() <<
"\n";
1143 llvm::errs() <<
"CALL\n--------------\n";
1147 else if (
const auto *ND = dyn_cast_or_null<NamedDecl>(getCallee()))
1148 llvm::errs() << *ND <<
"\n";
1154 llvm::errs() <<
"EVENT\n--------------\n";
1155 llvm::errs() << getString() <<
"\n";
1156 llvm::errs() <<
" ---- at ----\n";
1161 llvm::errs() <<
"CONTROL\n--------------\n";
1162 getStartLocation().dump();
1163 llvm::errs() <<
" ---- to ----\n";
1164 getEndLocation().dump();
1168 llvm::errs() <<
"MACRO\n--------------\n";
1173 llvm::errs() <<
"NOTE\n--------------\n";
1174 llvm::errs() << getString() <<
"\n";
1175 llvm::errs() <<
" ---- at ----\n";
1180 llvm::errs() <<
"POP-UP\n--------------\n";
1181 llvm::errs() << getString() <<
"\n";
1182 llvm::errs() <<
" ---- at ----\n";
1188 llvm::errs() <<
"<INVALID>\n";
1195 llvm::errs() <<
"<range>\n";
1198 asLocation().dump();
1199 llvm::errs() <<
"\n";
1205 llvm::errs() <<
"<NULL STMT>\n";
1208 if (
const auto *ND = dyn_cast_or_null<NamedDecl>(D))
1209 llvm::errs() << *ND <<
"\n";
1210 else if (isa<BlockDecl>(D))
1212 llvm::errs() <<
"<block>\n";
1214 llvm::errs() <<
"<unknown decl>\n";
1216 llvm::errs() <<
"<NULL DECL>\n";
SourceLocation getRBracLoc() const
Represents C++ allocator call.
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.
Expr * getInit() const
Get the initializer.
static Optional< bool > compareMacro(const PathDiagnosticMacroPiece &X, const PathDiagnosticMacroPiece &Y)
const Stmt * getStmt() const
Stmt * getBody() const
Get the body of the Declaration.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
Defines the clang::FileManager interface and associated types.
~PathDiagnosticMacroPiece() override
static void compute_path_size(const PathPieces &pieces, unsigned &size)
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
FullSourceLoc getExpansionLoc() const
Stmt - This represents one statement.
virtual ~PathDiagnosticPiece()
C Language Family Type Representation.
Defines the SourceManager interface.
Decl - This represents one declaration (or definition), e.g.
Represents a point when we begin processing an inlined call.
static PathDiagnosticLocation createBeginBrace(const CompoundStmt *CS, const SourceManager &SM)
Create a location for the beginning of the compound statement.
SourceLocation getBeginLoc() const LLVM_READONLY
~PathDiagnosticEventPiece() override
Defines the C++ template declaration subclasses.
void Profile(llvm::FoldingSetNodeID &ID) const
Profiles the diagnostic, independent of the path it references.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
Represents C++ object destructor generated from a call to delete.
std::shared_ptr< PathDiagnosticEventPiece > getCallEnterWithinCallerEvent() const
void Profile(llvm::FoldingSetNodeID &ID) const
A Range represents the closed range [from, to].
Represents a program point just before an implicit call event.
SourceLocation getEndLoc() const LLVM_READONLY
T castAs() const
Convert to the specified CFGElement type, asserting that this CFGElement is of the desired type...
void dump() const override
PathDiagnosticLocation getStartLocation() const
static PathDiagnosticLocation createEndBrace(const CompoundStmt *CS, const SourceManager &SM)
Create a location for the end of the compound statement.
SourceLocation getColonLoc() const
meta_iterator meta_begin() const
const Stmt * getTriggerStmt() const
Describes how types, statements, expressions, and declarations should be printed. ...
static PathDiagnosticLocation createDeclEnd(const LocationContext *LC, const SourceManager &SM)
Constructs a location for the end of the enclosing declaration body.
Defines the clang::Expr interface and subclasses for C++ expressions.
static PathDiagnosticLocation createSingleLocation(const PathDiagnosticLocation &PDL)
Convert the given location into a single kind location.
PathDiagnosticLocation getLocation() const
PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diagnostic.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
SourceLocation getBeginLoc() const LLVM_READONLY
AnalysisDeclContext contains the context data for the function or method under analysis.
Represents C++ object destructor implicitly generated for automatic object or temporary bound to cons...
StringRef getVerboseDescription() const
void dump() const override
~PathDiagnosticControlFlowPiece() override
virtual ~PathDiagnosticConsumer()
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents a point when we start the call exit sequence (for inlined call).
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::vector< std::pair< StringRef, StringRef > > ConsumerFiles
SourceLocation getLBracLoc() const
void Profile(llvm::FoldingSetNodeID &ID) const override
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
A builtin binary operation expression such as "x + y" or "x <= y".
void dump() const override
StringRef getBugType() const
meta_iterator meta_end() const
Represents a point after we ran remove dead bindings AFTER processing the given statement.
static PathDiagnosticLocation create(const Decl *D, const SourceManager &SM)
Create a location corresponding to the given declaration.
static Optional< bool > comparePath(const PathPieces &X, const PathPieces &Y)
PathDiagnosticLocation callEnter
virtual PathDiagnosticLocation getLocation() const =0
PathDiagnosticLocation getEndLocation() const
const CFGBlock * getCallSiteBlock() const
static PathDiagnosticLocation createMemberLoc(const MemberExpr *ME, const SourceManager &SM)
For member expressions, return the location of the '.
CXXCtorInitializer * getInitializer() const
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
ConditionalOperator - The ?: ternary operator.
CompoundStmt - This represents a group of statements like { stmt stmt }.
void HandlePathDiagnostic(std::unique_ptr< PathDiagnostic > D)
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...
Represents a single basic block in a source-level CFG.
PDFileEntry::ConsumerFiles * getFiles(const PathDiagnostic &PD)
Represents a point when we finish the call exit sequence (for inlined call).
void FullProfile(llvm::FoldingSetNodeID &ID) const
Profiles the diagnostic, including its path.
Stmt * getTerminatorCondition(bool StripParens=true)
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
std::pair< FileID, unsigned > getDecomposedLoc() const
Decompose the specified location into a raw FileID + Offset pair.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
const SourceManager & getManager() const
static PathDiagnosticLocation getLocationForCaller(const StackFrameContext *SFC, const LocationContext *CallerCtx, const SourceManager &SM)
static void describeTemplateParameters(raw_ostream &Out, const ArrayRef< TemplateArgument > TAList, const LangOptions &LO, StringRef Prefix=StringRef(), StringRef Postfix=StringRef())
llvm::PointerUnion< const LocationContext *, AnalysisDeclContext * > LocationOrAnalysisDeclContext
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
bool isBodyAutosynthesized() const
Checks if the body of the Decl is generated by the BodyFarm.
SourceLocation getEnd() const
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'...
PathDiagnosticPiece()=delete
StringRef getCategory() const
static Optional< bool > comparePiece(const PathDiagnosticPiece &X, const PathDiagnosticPiece &Y)
SourceLocation getEndLoc() const LLVM_READONLY
static PathDiagnosticLocation createDeclBegin(const LocationContext *LC, const SourceManager &SM)
Create a location for the beginning of the enclosing declaration body.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
~PathDiagnosticCallPiece() override
std::shared_ptr< PathDiagnosticEventPiece > getCallEnterEvent() const
bool isBeforeInTranslationUnitThan(SourceLocation Loc) const
Determines the order of 2 source locations in the translation unit.
Encodes a location in the source.
SourceLocation getOperatorLoc() const
StringRef getName() const
std::shared_ptr< PathDiagnosticEventPiece > getCallExitEvent() const
PathDiagnosticLocation callReturn
void setCallee(const CallEnter &CE, const SourceManager &SM)
Cached information about one file (either on disk or in the virtual file system). ...
std::deque< std::string >::const_iterator meta_iterator
static PathDiagnosticLocation createConditionalColonLoc(const ConditionalOperator *CO, const SourceManager &SM)
std::pair< bool, bool > isInTheSameTranslationUnit(std::pair< FileID, unsigned > &LOffs, std::pair< FileID, unsigned > &ROffs) const
Determines whether the two decomposed source location is in the same translation unit.
static bool describeCodeDecl(raw_ostream &Out, const Decl *D, bool ExtendedDescription, StringRef Prefix=StringRef())
static PathDiagnosticLocation createEnd(const Stmt *S, const SourceManager &SM, const LocationOrAnalysisDeclContext LAC)
Create a location for the end of the statement.
const Decl * getDecl() const
FullSourceLoc asLocation() const
void dump() const override
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
ConsumerFiles files
A vector of <consumer,file> pairs.
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.
Represents a program point just after an implicit call event.
virtual void Profile(llvm::FoldingSetNodeID &ID) const
static void describeClass(raw_ostream &Out, const CXXRecordDecl *D, StringRef Prefix=StringRef())
const StackFrameContext * getCalleeContext() const
void FlushDiagnostics(FilesMade *FilesMade)
const StackFrameContext * getCalleeContext() const
StmtClass getStmtClass() const
bool isVirtualBaseBranch() const
static Optional< bool > compareCall(const PathDiagnosticCallPiece &X, const PathDiagnosticCallPiece &Y)
void Profile(llvm::FoldingSetNodeID &ID) const override
const Decl * getDecl() const
const CXXDeleteExpr * getDeleteExpr() const
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
unsigned getIndex() const
static void describeTemplateParameter(raw_ostream &Out, const TemplateArgument &TArg, const LangOptions &LO)
const LocationContext * getLocationContext() const
void Profile(llvm::FoldingSetNodeID &ID) const override
static std::shared_ptr< PathDiagnosticCallPiece > construct(const CallExitEnd &CE, const SourceManager &SM)
A template argument list.
static PathDiagnosticLocation createOperatorLoc(const BinaryOperator *BO, const SourceManager &SM)
Create the location for the operator of the binary expression.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
const CXXNewExpr * getAllocatorExpr() const
ArgKind getKind() const
Return the kind of stored template argument.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
void dump() const override
Represents a top-level expression in a basic block.
static StringRef StripTrailingDots(StringRef s)
unsigned kind
All of the diagnostics that can be emitted by the frontend.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
FullSourceLoc getSpellingLoc() const
A SourceLocation and its associated SourceManager.
PathDiagnosticLocation callEnterWithin
static Decl::Kind getKind(const Decl *D)
void Profile(llvm::FoldingSetNodeID &ID) const override
SourceLocation getBeginLoc() const LLVM_READONLY
void addDiagnostic(const PathDiagnostic &PD, StringRef ConsumerName, StringRef fileName)
Represents C++ base or member initializer from constructor's initialization list. ...
~PathDiagnosticNotePiece() override
ParentMap & getParentMap()
A trivial tuple used to represent a source range.
Optional< T > getAs() const
Convert to the specified ProgramPoint type, returning None if this ProgramPoint is not of the desired...
CFGTerminator getTerminator() const
AnalysisDeclContext * getAnalysisDeclContext() const
StringRef getString() const
SourceLocation getBegin() const
static Optional< bool > compareControlFlow(const PathDiagnosticControlFlowPiece &X, const PathDiagnosticControlFlowPiece &Y)
This class handles loading and caching of source files into memory.
Represents C++ object destructor implicitly generated at the end of full expression for temporary obj...
SourceLocation getBodyRBrace() const
getBodyRBrace - Gets the right brace of the body, if a body exists.
SourceLocation getLocation() const
static bool compareCrossTUSourceLocs(FullSourceLoc XL, FullSourceLoc YL)
unsigned full_size()
Return the unrolled size of the path.
void Profile(llvm::FoldingSetNodeID &ID) const override
StringRef getShortDescription() const
const Decl * getDeclWithIssue() const
Return the semantic context where an issue occurred.