Skip to content

Commit d18ada0

Browse files
committed
C++: Remove unnamed and specialization types
1 parent b2ea30a commit d18ada0

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

cpp/common/src/ext/stdcpp14.generated.names.model.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ extensions:
5252
- [C++14, atomic, std, atomic_char]
5353
- [C++14, atomic, std, atomic_bool]
5454
- [C++14, thread, std, thread]
55-
- [C++14, thread, std, hash]
5655
- [C++14, thread, std, id]
5756
- [C++14, thread, std, native_handle_type]
5857
- [C++14, initializer_list, std, value_type]
@@ -65,7 +64,6 @@ extensions:
6564
- [C++14, iterator, std, value_type]
6665
- [C++14, iterator, std, reference]
6766
- [C++14, iterator, std, iterator]
68-
- [C++14, iterator, std, (unnamed enum)]
6967
- [C++14, iterator, std, iterator_category]
7068
- [C++14, iterator, std, random_access_iterator_tag]
7169
- [C++14, iterator, std, bidirectional_iterator_tag]
@@ -85,7 +83,6 @@ extensions:
8583
- [C++14, iterator, std, istream_type]
8684
- [C++14, iterator, std, streambuf_type]
8785
- [C++14, iterator, std, iterator_traits]
88-
- [C++14, random, std, (unnamed class/struct/union)]
8986
- [C++14, random, std, param_type]
9087
- [C++14, random, std, distribution_type]
9188
- [C++14, random, std, result_type]
@@ -132,7 +129,6 @@ extensions:
132129
- [C++14, exception, std, unexpected_handler]
133130
- [C++14, exception, std, terminate_handler]
134131
- [C++14, exception, 'std::__exception_ptr', exception_ptr]
135-
- [C++14, locale, std, (unnamed enum)]
136132
- [C++14, locale, std, int_type]
137133
- [C++14, locale, std, state_type]
138134
- [C++14, locale, std, char_type]
@@ -193,9 +189,7 @@ extensions:
193189
- [C++14, set, std, key_compare]
194190
- [C++14, set, std, multiset]
195191
- [C++14, bitset, std, reference]
196-
- [C++14, bitset, std, hash]
197192
- [C++14, bitset, std, bitset]
198-
- [C++14, system_error, std, hash]
199193
- [C++14, system_error, std, errc]
200194
- [C++14, system_error, std, is_error_condition_enum]
201195
- [C++14, system_error, std, system_error]
@@ -265,7 +259,6 @@ extensions:
265259
- [C++14, deque, std, reference]
266260
- [C++14, deque, std, size_type]
267261
- [C++14, deque, std, iterator]
268-
- [C++14, deque, std, (unnamed enum)]
269262
- [C++14, deque, std, iterator_category]
270263
- [C++14, deque, std, pointer]
271264
- [C++14, deque, std, difference_type]
@@ -289,7 +282,6 @@ extensions:
289282
- [C++14, future, std, value_type]
290283
- [C++14, future, std, pointer]
291284
- [C++14, future, std, result_type]
292-
- [C++14, future, std, is_error_code_enum]
293285
- [C++14, future, std, packaged_task]
294286
- [C++14, future, std, promise]
295287
- [C++14, future, std, shared_future]
@@ -339,7 +331,6 @@ extensions:
339331
- [C++14, vector, std, reference]
340332
- [C++14, vector, std, size_type]
341333
- [C++14, vector, std, iterator]
342-
- [C++14, vector, std, (unnamed enum)]
343334
- [C++14, vector, std, pointer]
344335
- [C++14, vector, std, difference_type]
345336
- [C++14, vector, std, reverse_iterator]
@@ -494,15 +485,13 @@ extensions:
494485
- [C++14, streambuf, std, pos_type]
495486
- [C++14, streambuf, std, traits_type]
496487
- [C++14, streambuf, std, basic_streambuf]
497-
- [C++14, ios, std, (unnamed enum)]
498488
- [C++14, ios, std, streamoff]
499489
- [C++14, ios, std, int_type]
500490
- [C++14, ios, std, off_type]
501491
- [C++14, ios, std, char_type]
502492
- [C++14, ios, std, pos_type]
503493
- [C++14, ios, std, ios_base]
504494
- [C++14, ios, std, traits_type]
505-
- [C++14, ios, std, is_error_code_enum]
506495
- [C++14, ios, std, Init]
507496
- [C++14, ios, std, failure]
508497
- [C++14, ios, std, event_callback]
@@ -519,13 +508,11 @@ extensions:
519508
- [C++14, ios, std, streampos]
520509
- [C++14, string, std, type]
521510
- [C++14, string, std, value_type]
522-
- [C++14, string, std, (unnamed class/struct/union)]
523511
- [C++14, string, std, const_iterator]
524512
- [C++14, string, std, const_reference]
525513
- [C++14, string, std, reference]
526514
- [C++14, string, std, size_type]
527515
- [C++14, string, std, iterator]
528-
- [C++14, string, std, (unnamed enum)]
529516
- [C++14, string, std, iterator_category]
530517
- [C++14, string, std, pointer]
531518
- [C++14, string, std, difference_type]
@@ -545,7 +532,6 @@ extensions:
545532
- [C++14, string, std, char_type]
546533
- [C++14, string, std, pos_type]
547534
- [C++14, string, std, allocator_type]
548-
- [C++14, string, std, hash]
549535
- [C++14, string, std, basic_string]
550536
- [C++14, string, std, traits_type]
551537
- [C++14, string, std, basic_stringbuf]
@@ -628,7 +614,6 @@ extensions:
628614
- [C++14, type_traits, std, remove_volatile_t]
629615
- [C++14, type_traits, std, remove_const_t]
630616
- [C++14, type_traits, std, value_type]
631-
- [C++14, type_traits, std, (unnamed class/struct/union)]
632617
- [C++14, type_traits, std, is_signed]
633618
- [C++14, type_traits, std, false_type]
634619
- [C++14, type_traits, std, true_type]
@@ -818,7 +803,6 @@ extensions:
818803
- [C++14, typeinfo, std, type_info]
819804
- [C++14, typeinfo, std, bad_typeid]
820805
- [C++14, typeinfo, std, bad_cast]
821-
- [C++14, algorithm, std, (unnamed enum)]
822806
- [C++14, iosfwd, std, fpos]
823807
- [C++14, iosfwd, std, streamsize]
824808
- [C++14, iosfwd, std, streamoff]
@@ -852,8 +836,6 @@ extensions:
852836
- [C++14, iosfwd, std, u32streampos]
853837
- [C++14, iosfwd, std, u16streampos]
854838
- [C++14, iosfwd, std, wstreampos]
855-
- [C++14, cmath, std, (unnamed enum)]
856-
- [C++14, stdexcept, std, (unnamed class/struct/union)]
857839
- [C++14, stdexcept, std, invalid_argument]
858840
- [C++14, stdexcept, std, underflow_error]
859841
- [C++14, stdexcept, std, overflow_error]
@@ -872,7 +854,6 @@ extensions:
872854
- [C++14, memory, std, reference]
873855
- [C++14, memory, std, size_type]
874856
- [C++14, memory, std, iterator]
875-
- [C++14, memory, std, (unnamed enum)]
876857
- [C++14, memory, std, pointer]
877858
- [C++14, memory, std, difference_type]
878859
- [C++14, memory, std, element_type]
@@ -908,7 +889,6 @@ extensions:
908889
- [C++14, memory, std, allocator_traits]
909890
- [C++14, typeindex, std, result_type]
910891
- [C++14, typeindex, std, argument_type]
911-
- [C++14, typeindex, std, hash]
912892
- [C++14, typeindex, std, type_index]
913893
- addsTo: {extensible: libraryFunctionModel, pack: codeql/common-cpp-coding-standards}
914894
data:

scripts/generate_standard_library_models/cpp/queries/libraryTypeModel.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ where
99
// includes types outside the C/C++ standard library.
1010
declInVisibleStdNamespace(t) and
1111
// Do not report types from template instantiations - instead report the uninstantiated template
12-
not t.isFromTemplateInstantiation(_)
12+
not t.isFromTemplateInstantiation(_) and
13+
// Ignore full tempalte specializations (partial specializations are fine)
14+
not t instanceof FullClassTemplateSpecialization and
15+
// Remove unnamed types, because they do not have a reserved name
16+
not t.isAnonymous()
1317
select getStandard(), getAClosestStandardLibraryHeader(t.getFile()).getBaseName(),
1418
getVisibleNamespaceString(t.getNamespace()), t.getSimpleName()

0 commit comments

Comments
 (0)