/proc/self/cwd/base/attribute.cc
Line | Count | Source |
1 | | // Copyright 2022 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #include "base/attribute.h" |
16 | | |
17 | | #include <cstddef> |
18 | | #include <cstdint> |
19 | | #include <string> |
20 | | #include <type_traits> |
21 | | #include <variant> |
22 | | |
23 | | #include "absl/algorithm/container.h" |
24 | | #include "absl/base/macros.h" |
25 | | #include "absl/base/nullability.h" |
26 | | #include "absl/log/absl_check.h" |
27 | | #include "absl/meta/type_traits.h" |
28 | | #include "absl/status/status.h" |
29 | | #include "absl/status/statusor.h" |
30 | | #include "absl/strings/str_cat.h" |
31 | | #include "absl/strings/string_view.h" |
32 | | #include "base/kind.h" |
33 | | #include "internal/status_macros.h" |
34 | | #include "internal/strings.h" |
35 | | |
36 | | namespace cel { |
37 | | |
38 | | namespace { |
39 | | |
40 | | // Visitor for appending string representation for different qualifier kinds. |
41 | | class AttributeStringPrinter { |
42 | | public: |
43 | | // String representation for the given qualifier is appended to output. |
44 | | // output must be non-null. |
45 | 0 | explicit AttributeStringPrinter(std::string* output) : output_(*output) {} |
46 | | |
47 | 0 | absl::Status operator()(std::monostate) const { |
48 | 0 | return absl::InvalidArgumentError("bad attribute qualifier"); |
49 | 0 | } |
50 | | |
51 | 0 | absl::Status operator()(int64_t index) { |
52 | 0 | absl::StrAppend(&output_, "[", index, "]"); |
53 | 0 | return absl::OkStatus(); |
54 | 0 | } |
55 | | |
56 | 0 | absl::Status operator()(uint64_t index) { |
57 | 0 | absl::StrAppend(&output_, "[", index, "]"); |
58 | 0 | return absl::OkStatus(); |
59 | 0 | } |
60 | | |
61 | 0 | absl::Status operator()(bool bool_key) { |
62 | 0 | absl::StrAppend(&output_, "[", (bool_key) ? "true" : "false", "]"); |
63 | 0 | return absl::OkStatus(); |
64 | 0 | } |
65 | | |
66 | 0 | absl::Status operator()(const std::string& field) { |
67 | 0 | absl::StrAppend(&output_, ".", field); |
68 | 0 | return absl::OkStatus(); |
69 | 0 | } |
70 | | |
71 | | private: |
72 | | std::string& output_; |
73 | | }; |
74 | | |
75 | | // Visitor for appending string representation for different qualifier kinds. |
76 | | class AttributeQualifierStringPrinter { |
77 | | public: |
78 | | // String representation for the given qualifier is appended to output. |
79 | | explicit AttributeQualifierStringPrinter(std::string* absl_nonnull output) |
80 | 0 | : output_(*output) {} |
81 | | |
82 | 0 | absl::Status operator()(std::monostate) const { |
83 | | // Attributes are represented as a variant, with illegal attribute |
84 | | // qualifiers represented with their type as the first alternative. |
85 | 0 | return absl::InvalidArgumentError("bad attribute qualifier"); |
86 | 0 | } |
87 | | |
88 | 0 | absl::Status operator()(int64_t index) { |
89 | 0 | absl::StrAppend(&output_, index); |
90 | 0 | return absl::OkStatus(); |
91 | 0 | } |
92 | | |
93 | 0 | absl::Status operator()(uint64_t index) { |
94 | 0 | absl::StrAppend(&output_, index); |
95 | 0 | return absl::OkStatus(); |
96 | 0 | } |
97 | | |
98 | 0 | absl::Status operator()(bool bool_key) { |
99 | 0 | absl::StrAppend(&output_, (bool_key) ? "true" : "false"); |
100 | 0 | return absl::OkStatus(); |
101 | 0 | } |
102 | | |
103 | 0 | absl::Status operator()(const std::string& field) { |
104 | 0 | absl::StrAppend(&output_, field); |
105 | 0 | return absl::OkStatus(); |
106 | 0 | } |
107 | | |
108 | | private: |
109 | | std::string& output_; |
110 | | }; |
111 | | |
112 | | struct AttributeQualifierTypeVisitor final { |
113 | 0 | Kind operator()(std::monostate) const { return Kind::kNull; } |
114 | | |
115 | 0 | Kind operator()(int64_t) const { return Kind::kInt64; } |
116 | | |
117 | 0 | Kind operator()(uint64_t) const { return Kind::kUint64; } |
118 | | |
119 | 0 | Kind operator()(const std::string&) const { return Kind::kString; } |
120 | | |
121 | 0 | Kind operator()(bool) const { return Kind::kBool; } |
122 | | }; |
123 | | |
124 | | struct AttributeQualifierToString { |
125 | 0 | void operator()(std::monostate) const {} |
126 | | |
127 | 0 | void operator()(bool value) const { output.append(value ? "true" : "false"); } |
128 | | |
129 | 0 | void operator()(int64_t value) const { absl::StrAppend(&output, value); } |
130 | | |
131 | 0 | void operator()(uint64_t value) const { |
132 | 0 | absl::StrAppend(&output, value, "u"); |
133 | 0 | } |
134 | | |
135 | 0 | void operator()(absl::string_view value) const { |
136 | 0 | absl::StrAppend(&output, internal::FormatStringLiteral(value)); |
137 | 0 | } |
138 | | |
139 | 0 | void operator()(common_internal::WildcardType) const { output.append("*"); } |
140 | | |
141 | | std::string& output; |
142 | | }; |
143 | | |
144 | | } // namespace |
145 | | |
146 | 0 | Kind AttributeQualifier::kind() const { |
147 | 0 | return std::visit(AttributeQualifierTypeVisitor{}, value_); |
148 | 0 | } |
149 | | |
150 | 0 | bool Attribute::operator==(const Attribute& other) const { |
151 | | // We cannot check pointer equality as a short circuit because we have to |
152 | | // treat all invalid AttributeQualifier as not equal to each other. |
153 | | // TODO(issues/41) we only support Ident-rooted attributes at the moment. |
154 | 0 | if (variable_name() != other.variable_name()) { |
155 | 0 | return false; |
156 | 0 | } |
157 | | |
158 | 0 | if (qualifier_path().size() != other.qualifier_path().size()) { |
159 | 0 | return false; |
160 | 0 | } |
161 | | |
162 | 0 | for (size_t i = 0; i < qualifier_path().size(); i++) { |
163 | 0 | if (!(qualifier_path()[i] == other.qualifier_path()[i])) { |
164 | 0 | return false; |
165 | 0 | } |
166 | 0 | } |
167 | | |
168 | 0 | return true; |
169 | 0 | } |
170 | | |
171 | 0 | bool Attribute::operator<(const Attribute& other) const { |
172 | 0 | if (impl_.get() == other.impl_.get()) { |
173 | 0 | return false; |
174 | 0 | } |
175 | 0 | auto lhs_begin = qualifier_path().begin(); |
176 | 0 | auto lhs_end = qualifier_path().end(); |
177 | 0 | auto rhs_begin = other.qualifier_path().begin(); |
178 | 0 | auto rhs_end = other.qualifier_path().end(); |
179 | 0 | while (lhs_begin != lhs_end && rhs_begin != rhs_end) { |
180 | 0 | if (*lhs_begin < *rhs_begin) { |
181 | 0 | return true; |
182 | 0 | } |
183 | 0 | if (!(*lhs_begin == *rhs_begin)) { |
184 | 0 | return false; |
185 | 0 | } |
186 | 0 | lhs_begin++; |
187 | 0 | rhs_begin++; |
188 | 0 | } |
189 | 0 | if (lhs_begin == lhs_end && rhs_begin == rhs_end) { |
190 | | // Neither has any elements left, they are equal. Compare variable names. |
191 | 0 | return variable_name() < other.variable_name(); |
192 | 0 | } |
193 | 0 | if (lhs_begin == lhs_end) { |
194 | | // Left has no more elements. Right is greater. |
195 | 0 | return true; |
196 | 0 | } |
197 | | // Right has no more elements. Left is greater. |
198 | 0 | ABSL_ASSERT(rhs_begin == rhs_end); |
199 | 0 | return false; |
200 | 0 | } |
201 | | |
202 | 0 | absl::StatusOr<std::string> Attribute::AsString() const { |
203 | 0 | if (variable_name().empty()) { |
204 | 0 | return absl::InvalidArgumentError( |
205 | 0 | "Only ident rooted attributes are supported."); |
206 | 0 | } |
207 | | |
208 | 0 | std::string result = std::string(variable_name()); |
209 | |
|
210 | 0 | for (const auto& qualifier : qualifier_path()) { |
211 | 0 | CEL_RETURN_IF_ERROR(std::visit(AttributeStringPrinter(&result), |
212 | 0 | common_internal::AsVariant(qualifier))); |
213 | 0 | } |
214 | | |
215 | 0 | return result; |
216 | 0 | } |
217 | | |
218 | 0 | std::string Attribute::ToString() const { |
219 | 0 | std::string result; |
220 | 0 | result.append(variable_name()); |
221 | 0 | for (const auto& qualifier : qualifier_path()) { |
222 | 0 | result.push_back('['); |
223 | 0 | std::visit(AttributeQualifierToString{result}, |
224 | 0 | common_internal::AsVariant(qualifier)); |
225 | 0 | result.push_back(']'); |
226 | 0 | } |
227 | 0 | return result; |
228 | 0 | } |
229 | | |
230 | 0 | std::string AttributePattern::ToString() const { |
231 | 0 | std::string result; |
232 | 0 | result.append(variable()); |
233 | 0 | for (const auto& qualifier : qualifier_path()) { |
234 | 0 | result.push_back('['); |
235 | 0 | std::visit(AttributeQualifierToString{result}, |
236 | 0 | common_internal::AsVariant(qualifier)); |
237 | 0 | result.push_back(']'); |
238 | 0 | } |
239 | 0 | return result; |
240 | 0 | } |
241 | | |
242 | | std::string AttributeQualifier::ToString() const { |
243 | | std::string result; |
244 | | absl::Status status = |
245 | | std::visit(AttributeQualifierStringPrinter{&result}, value_); |
246 | | ABSL_DCHECK_OK(status) << "bad attribute qualifier"; |
247 | | status.IgnoreError(); |
248 | | return result; |
249 | | } |
250 | | |
251 | 0 | bool AttributeQualifier::IsMatch(const AttributeQualifier& other) const { |
252 | 0 | ABSL_DCHECK(*this) << "bad attribute qualifier"; |
253 | 0 | ABSL_DCHECK(other) << "bad attribute qualifier"; |
254 | 0 | if (std::holds_alternative<std::monostate>(value_) || |
255 | 0 | std::holds_alternative<std::monostate>(other.value_)) { |
256 | 0 | return false; |
257 | 0 | } |
258 | 0 | return *this == other; |
259 | 0 | } |
260 | | |
261 | 0 | bool AttributeQualifier::IsMatch(absl::string_view other_key) const { |
262 | 0 | ABSL_DCHECK(*this) << "bad attribute qualifier"; |
263 | 0 | if (auto string = AsString(); string.has_value()) { |
264 | 0 | return *string == other_key; |
265 | 0 | } |
266 | 0 | return false; |
267 | 0 | } |
268 | | |
269 | | bool AttributeQualifierPattern::IsMatch( |
270 | 0 | const AttributeQualifier& qualifier) const { |
271 | 0 | ABSL_DCHECK(*this) << "bad attribute qualifier pattern"; |
272 | 0 | ABSL_DCHECK(qualifier) << "bad attribute qualifier"; |
273 | 0 | if (!*this || !qualifier) { |
274 | 0 | return false; |
275 | 0 | } |
276 | 0 | if (IsWildcard()) { |
277 | 0 | return true; |
278 | 0 | } |
279 | 0 | return *this == qualifier; |
280 | 0 | } |
281 | | |
282 | 0 | bool AttributeQualifierPattern::IsMatch(absl::string_view other_key) const { |
283 | 0 | ABSL_DCHECK(*this) << "bad attribute qualifier pattern"; |
284 | 0 | if (IsWildcard()) { |
285 | 0 | return true; |
286 | 0 | } |
287 | 0 | if (auto string = AsString(); string.has_value()) { |
288 | 0 | return *string == other_key; |
289 | 0 | } |
290 | 0 | return false; |
291 | 0 | } |
292 | | |
293 | | namespace { |
294 | | |
295 | | struct AttributeQualifierEqualTo { |
296 | 0 | bool operator()(const std::monostate&, const std::monostate&) const { |
297 | 0 | return false; |
298 | 0 | } |
299 | | |
300 | | template <typename T> |
301 | | std::enable_if_t<!std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
302 | | bool> |
303 | 0 | operator()(const std::monostate&, const T&) const { |
304 | 0 | return false; |
305 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIlEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclImEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSH_RKSE_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIbEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSF_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINS_15common_internal12WildcardTypeEEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS5_9monostateEEEbE4typeERKSD_RKSA_ |
306 | | |
307 | | template <typename T> |
308 | | std::enable_if_t<!std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
309 | | bool> |
310 | 0 | operator()(const T&, const std::monostate&) const { |
311 | 0 | return false; |
312 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIlEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclImEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSE_RKSH_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIbEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSC_RKSF_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINS_15common_internal12WildcardTypeEEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS5_9monostateEEEbE4typeERKSA_RKSD_ |
313 | | |
314 | 0 | bool operator()(bool lhs, bool rhs) const { return lhs == rhs; } |
315 | | |
316 | 0 | bool operator()(bool, int64_t) const { return false; } |
317 | | |
318 | 0 | bool operator()(bool, uint64_t) const { return false; } |
319 | | |
320 | 0 | bool operator()(bool, absl::string_view) const { return false; } |
321 | | |
322 | 0 | bool operator()(int64_t, bool) const { return false; } |
323 | | |
324 | 0 | bool operator()(int64_t lhs, int64_t rhs) const { return lhs == rhs; } |
325 | | |
326 | 0 | bool operator()(int64_t, uint64_t) const { return false; } |
327 | | |
328 | 0 | bool operator()(int64_t, absl::string_view) const { return false; } |
329 | | |
330 | 0 | bool operator()(uint64_t, bool) const { return false; } |
331 | | |
332 | 0 | bool operator()(uint64_t, int64_t) const { return false; } |
333 | | |
334 | 0 | bool operator()(uint64_t lhs, uint64_t rhs) const { return lhs == rhs; } |
335 | | |
336 | 0 | bool operator()(uint64_t, absl::string_view) const { return false; } |
337 | | |
338 | 0 | bool operator()(absl::string_view, bool) const { return false; } |
339 | | |
340 | 0 | bool operator()(absl::string_view, int64_t) const { return false; } |
341 | | |
342 | 0 | bool operator()(absl::string_view, uint64_t) const { return false; } |
343 | | |
344 | 0 | bool operator()(absl::string_view lhs, absl::string_view rhs) const { |
345 | 0 | return lhs == rhs; |
346 | 0 | } |
347 | | |
348 | | bool operator()(const common_internal::WildcardType&, |
349 | 0 | const common_internal::WildcardType&) const { |
350 | 0 | return true; |
351 | 0 | } |
352 | | |
353 | | template <typename T> |
354 | | std::enable_if_t< |
355 | | !std::is_same_v<absl::remove_cvref_t<T>, common_internal::WildcardType> && |
356 | | !std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
357 | | bool> |
358 | 0 | operator()(const common_internal::WildcardType&, const T&) const { |
359 | 0 | return false; |
360 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIlEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclImEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISG_NS3_9monostateEEEbE4typeERKSI_RKSE_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIbEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISE_NS3_9monostateEEEbE4typeERKSG_RKSC_ |
361 | | |
362 | | template <typename T> |
363 | | std::enable_if_t< |
364 | | !std::is_same_v<absl::remove_cvref_t<T>, common_internal::WildcardType> && |
365 | | !std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
366 | | bool> |
367 | 0 | operator()(const T&, const common_internal::WildcardType&) const { |
368 | 0 | return false; |
369 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIlEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclImEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISG_NS3_9monostateEEEbE4typeERKSE_RKSI_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclIbEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_125AttributeQualifierEqualToclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISE_NS3_9monostateEEEbE4typeERKSC_RKSG_ |
370 | | }; |
371 | | |
372 | | struct AttributeQualifierLess { |
373 | 0 | bool operator()(const std::monostate&, const std::monostate&) const { |
374 | 0 | return false; |
375 | 0 | } |
376 | | |
377 | | template <typename T> |
378 | | std::enable_if_t<!std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
379 | | bool> |
380 | 0 | operator()(const std::monostate&, const T&) const { |
381 | 0 | return true; |
382 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIlEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclImEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSH_RKSE_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIbEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSB_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSF_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINS_15common_internal12WildcardTypeEEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS5_9monostateEEEbE4typeERKSD_RKSA_ |
383 | | |
384 | | template <typename T> |
385 | | std::enable_if_t<!std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
386 | | bool> |
387 | 0 | operator()(const T&, const std::monostate&) const { |
388 | 0 | return false; |
389 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIlEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclImEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSE_RKSH_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIbEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKS8_RKSB_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS3_9monostateEEEbE4typeERKSC_RKSF_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINS_15common_internal12WildcardTypeEEENSt3__19enable_ifIXntsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS5_9monostateEEEbE4typeERKSA_RKSD_ |
390 | | |
391 | 0 | bool operator()(bool lhs, bool rhs) const { return lhs < rhs; } |
392 | | |
393 | 0 | bool operator()(bool, int64_t) const { return false; } |
394 | | |
395 | 0 | bool operator()(bool, uint64_t) const { return false; } |
396 | | |
397 | 0 | bool operator()(bool, absl::string_view) const { return false; } |
398 | | |
399 | 0 | bool operator()(int64_t, bool) const { return true; } |
400 | | |
401 | 0 | bool operator()(int64_t lhs, int64_t rhs) const { return lhs < rhs; } |
402 | | |
403 | 0 | bool operator()(int64_t, uint64_t) const { return true; } |
404 | | |
405 | 0 | bool operator()(int64_t, absl::string_view) const { return true; } |
406 | | |
407 | 0 | bool operator()(uint64_t, bool) const { return true; } |
408 | | |
409 | 0 | bool operator()(uint64_t, int64_t) const { return false; } |
410 | | |
411 | 0 | bool operator()(uint64_t lhs, uint64_t rhs) const { return lhs < rhs; } |
412 | | |
413 | 0 | bool operator()(uint64_t, absl::string_view) const { return true; } |
414 | | |
415 | 0 | bool operator()(absl::string_view, bool) const { return true; } |
416 | | |
417 | 0 | bool operator()(absl::string_view, int64_t) const { return false; } |
418 | | |
419 | 0 | bool operator()(absl::string_view, uint64_t) const { return false; } |
420 | | |
421 | 0 | bool operator()(absl::string_view lhs, absl::string_view rhs) const { |
422 | 0 | return lhs < rhs; |
423 | 0 | } |
424 | | |
425 | | bool operator()(const common_internal::WildcardType&, |
426 | 0 | const common_internal::WildcardType&) const { |
427 | 0 | return false; |
428 | 0 | } |
429 | | |
430 | | template <typename T> |
431 | | std::enable_if_t< |
432 | | !std::is_same_v<absl::remove_cvref_t<T>, common_internal::WildcardType> && |
433 | | !std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
434 | | bool> |
435 | 0 | operator()(const common_internal::WildcardType&, const T&) const { |
436 | 0 | return false; |
437 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIlEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclImEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISG_NS3_9monostateEEEbE4typeERKSI_RKSE_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIbEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKSC_RKS8_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISE_NS3_9monostateEEEbE4typeERKSG_RKSC_ |
438 | | |
439 | | template <typename T> |
440 | | std::enable_if_t< |
441 | | !std::is_same_v<absl::remove_cvref_t<T>, common_internal::WildcardType> && |
442 | | !std::is_same_v<absl::remove_cvref_t<T>, std::monostate>, |
443 | | bool> |
444 | 0 | operator()(const T&, const common_internal::WildcardType&) const { |
445 | 0 | return true; |
446 | 0 | } Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIlEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclImEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISG_NS3_9monostateEEEbE4typeERKSE_RKSI_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclIbEENSt3__19enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISA_NS3_9monostateEEEbE4typeERKS8_RKSC_ Unexecuted instantiation: attribute.cc:_ZNK3cel12_GLOBAL__N_122AttributeQualifierLessclINSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEEENS3_9enable_ifIXaantsr3stdE9is_same_vIN4absl12lts_2026052612remove_cvrefIT_E4typeENS_15common_internal12WildcardTypeEEntsr3stdE9is_same_vISE_NS3_9monostateEEEbE4typeERKSC_RKSG_ |
447 | | }; |
448 | | |
449 | | } // namespace |
450 | | |
451 | 0 | bool operator==(const AttributeQualifier& lhs, const AttributeQualifier& rhs) { |
452 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
453 | 0 | common_internal::AsVariant(lhs), |
454 | 0 | common_internal::AsVariant(rhs)); |
455 | 0 | } |
456 | | |
457 | | bool operator==(const AttributeQualifierView& lhs, |
458 | 0 | const AttributeQualifierView& rhs) { |
459 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
460 | 0 | common_internal::AsVariant(lhs), |
461 | 0 | common_internal::AsVariant(rhs)); |
462 | 0 | } |
463 | | |
464 | | bool operator==(const AttributeQualifierPattern& lhs, |
465 | 0 | const AttributeQualifierPattern& rhs) { |
466 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
467 | 0 | common_internal::AsVariant(lhs), |
468 | 0 | common_internal::AsVariant(rhs)); |
469 | 0 | } |
470 | | |
471 | | bool operator==(const AttributeQualifier& lhs, |
472 | 0 | const AttributeQualifierView& rhs) { |
473 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
474 | 0 | common_internal::AsVariant(lhs), |
475 | 0 | common_internal::AsVariant(rhs)); |
476 | 0 | } |
477 | | |
478 | | bool operator==(const AttributeQualifier& lhs, |
479 | 0 | const AttributeQualifierPattern& rhs) { |
480 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
481 | 0 | common_internal::AsVariant(lhs), |
482 | 0 | common_internal::AsVariant(rhs)); |
483 | 0 | } |
484 | | |
485 | | bool operator==(const AttributeQualifierView& lhs, |
486 | 0 | const AttributeQualifier& rhs) { |
487 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
488 | 0 | common_internal::AsVariant(lhs), |
489 | 0 | common_internal::AsVariant(rhs)); |
490 | 0 | } |
491 | | |
492 | | bool operator==(const AttributeQualifierView& lhs, |
493 | 0 | const AttributeQualifierPattern& rhs) { |
494 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
495 | 0 | common_internal::AsVariant(lhs), |
496 | 0 | common_internal::AsVariant(rhs)); |
497 | 0 | } |
498 | | |
499 | | bool operator==(const AttributeQualifierPattern& lhs, |
500 | 0 | const AttributeQualifier& rhs) { |
501 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
502 | 0 | common_internal::AsVariant(lhs), |
503 | 0 | common_internal::AsVariant(rhs)); |
504 | 0 | } |
505 | | |
506 | | bool operator==(const AttributeQualifierPattern& lhs, |
507 | 0 | const AttributeQualifierView& rhs) { |
508 | 0 | return std::visit(AttributeQualifierEqualTo{}, |
509 | 0 | common_internal::AsVariant(lhs), |
510 | 0 | common_internal::AsVariant(rhs)); |
511 | 0 | } |
512 | | |
513 | 0 | bool operator<(const AttributeQualifier& lhs, const AttributeQualifier& rhs) { |
514 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
515 | 0 | common_internal::AsVariant(rhs)); |
516 | 0 | } |
517 | | |
518 | | bool operator<(const AttributeQualifierView& lhs, |
519 | 0 | const AttributeQualifierView& rhs) { |
520 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
521 | 0 | common_internal::AsVariant(rhs)); |
522 | 0 | } |
523 | | |
524 | | bool operator<(const AttributeQualifierPattern& lhs, |
525 | 0 | const AttributeQualifierPattern& rhs) { |
526 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
527 | 0 | common_internal::AsVariant(rhs)); |
528 | 0 | } |
529 | | |
530 | | bool operator<(const AttributeQualifier& lhs, |
531 | 0 | const AttributeQualifierView& rhs) { |
532 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
533 | 0 | common_internal::AsVariant(rhs)); |
534 | 0 | } |
535 | | |
536 | | bool operator<(const AttributeQualifier& lhs, |
537 | 0 | const AttributeQualifierPattern& rhs) { |
538 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
539 | 0 | common_internal::AsVariant(rhs)); |
540 | 0 | } |
541 | | |
542 | | bool operator<(const AttributeQualifierView& lhs, |
543 | 0 | const AttributeQualifier& rhs) { |
544 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
545 | 0 | common_internal::AsVariant(rhs)); |
546 | 0 | } |
547 | | |
548 | | bool operator<(const AttributeQualifierView& lhs, |
549 | 0 | const AttributeQualifierPattern& rhs) { |
550 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
551 | 0 | common_internal::AsVariant(rhs)); |
552 | 0 | } |
553 | | |
554 | | bool operator<(const AttributeQualifierPattern& lhs, |
555 | 0 | const AttributeQualifier& rhs) { |
556 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
557 | 0 | common_internal::AsVariant(rhs)); |
558 | 0 | } |
559 | | |
560 | | bool operator<(const AttributeQualifierPattern& lhs, |
561 | 0 | const AttributeQualifierView& rhs) { |
562 | 0 | return std::visit(AttributeQualifierLess{}, common_internal::AsVariant(lhs), |
563 | 0 | common_internal::AsVariant(rhs)); |
564 | 0 | } |
565 | | |
566 | 0 | bool operator==(const AttributePattern& lhs, const AttributePattern& rhs) { |
567 | 0 | return lhs.variable() == rhs.variable() && |
568 | 0 | absl::c_equal(lhs.qualifier_path(), rhs.qualifier_path()); |
569 | 0 | } |
570 | | |
571 | | } // namespace cel |