20inline bool hasSuppression(
const Decl *
D) {
23 if (
const auto *Suppression =
D->
getAttr<SuppressAttr>())
24 return !Suppression->isGSL() &&
25 (Suppression->diagnosticIdentifiers().empty());
31 return llvm::any_of(S->getAttrs(), [](
const Attr *A) {
32 const auto *Suppression = dyn_cast<SuppressAttr>(A);
33 return Suppression && !Suppression->isGSL() &&
34 (Suppression->diagnosticIdentifiers().empty());
62 return !
SM.isBeforeInTranslationUnit(RHS, LHS);
82 CacheInitializer(ToInit).TraverseDecl(
const_cast<Decl *
>(
D));
90 return VisitAttributedNode(
D);
97 return VisitAttributedNode(AS);
101 template <
class NodeType>
bool VisitAttributedNode(NodeType *
Node) {
102 if (hasSuppression(
Node)) {
118 CacheInitializer(Ranges &R) : Result(R) {}
139 const Decl *DeclWithIssue,
144 if (!DeclWithIssue) {
159 if (
Parent ==
nullptr || isa<TranslationUnitDecl>(
Parent))
176 auto InsertionResult = CachedSuppressionLocations.insert(
178 Ranges &SuppressionRanges = InsertionResult.first->second;
179 if (InsertionResult.second) {
181 CacheInitializer::initialize(DeclWithIssue, SuppressionRanges);
187 return llvm::any_of(SuppressionRanges,
189 return fullyContains(Suppression, BugRange,
SM);
static CharSourceRange getRange(const CharSourceRange &EditRange, const SourceManager &SM, const LangOptions &LangOpts, bool IncludeMacroExpansion)
TranslationUnitDecl * getTranslationUnitDecl() const
Attr - This represents one attribute.
Represents an attribute applied to a statement.
Decl - This represents one declaration (or definition), e.g.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
SourceRange getSourceRange() const
For nodes which represent textual entities in the source code, return their SourceRange.