clang 24.0.0git
SharedLexicalRepresentation.h
Go to the documentation of this file.
1//===- SharedLexicalRepresentation.h ----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_SHAREDLEXICALREPRESENTATION_SHAREDLEXICALREPRESENTATION_H
10#define LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_SHAREDLEXICALREPRESENTATION_SHAREDLEXICALREPRESENTATION_H
11
14#include "llvm/ADT/ArrayRef.h"
15#include "llvm/ADT/StringRef.h"
16#include <string>
17#include <tuple>
18#include <vector>
19
20namespace clang::ssaf {
21
22/// A canonical (file, line, column) triple for one declaration site.
24 std::string FilePath;
25 unsigned Line = 0;
26 unsigned Column = 0;
27
29 return std::tie(FilePath, Line, Column) ==
30 std::tie(Other.FilePath, Other.Line, Other.Column);
31 }
32
34 return std::tie(FilePath, Line, Column) <
35 std::tie(Other.FilePath, Other.Line, Other.Column);
36 }
37};
38
39/// An EntitySourceLocationsSummary contains one SourceLocationRecord per
40/// declaration site contributed by an entity.
41class EntitySourceLocationsSummary final : public EntitySummary {
42 std::vector<SourceLocationRecord> DeclLocations;
43
44 friend EntitySourceLocationsSummary
45 buildEntitySourceLocationsSummary(std::vector<SourceLocationRecord>);
47 getDeclLocations(const EntitySourceLocationsSummary &);
48
49 explicit EntitySourceLocationsSummary(
50 std::vector<SourceLocationRecord> DeclLocations)
51 : DeclLocations(std::move(DeclLocations)) {}
52
53public:
54 static constexpr llvm::StringLiteral Name = "EntitySourceLocations";
55
56 SummaryName getSummaryName() const override { return summaryName(); }
57
58 bool operator==(const EntitySourceLocationsSummary &Other) const {
59 return DeclLocations == Other.DeclLocations;
60 }
61
62 bool empty() const { return DeclLocations.empty(); }
63
64 static SummaryName summaryName() { return SummaryName{Name.str()}; }
65};
66
67} // namespace clang::ssaf
68
69#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_SHAREDLEXICALREPRESENTATION_SHAREDLEXICALREPRESENTATION_H
bool operator==(const EntitySourceLocationsSummary &Other) const
friend llvm::ArrayRef< SourceLocationRecord > getDeclLocations(const EntitySourceLocationsSummary &)
friend EntitySourceLocationsSummary buildEntitySourceLocationsSummary(std::vector< SourceLocationRecord >)
Base class for analysis-specific summary data.
Uniquely identifies an analysis summary.
Definition SummaryName.h:22
@ Other
Other implicit parameter.
Definition Decl.h:1774
A canonical (file, line, column) triple for one declaration site.
bool operator<(const SourceLocationRecord &Other) const
bool operator==(const SourceLocationRecord &Other) const