mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #3074 from matt-gretton-dann/codeql-c-extractor/50-char8_t
Add support for C++20's char8_t type.
This commit is contained in:
@@ -376,6 +376,8 @@ private predicate isIntegralType(@builtintype type, int kind) {
|
||||
kind = 43
|
||||
or
|
||||
kind = 44
|
||||
or
|
||||
kind = 51
|
||||
)
|
||||
}
|
||||
|
||||
@@ -463,6 +465,8 @@ private predicate integralTypeMapping(int original, int canonical, int unsigned,
|
||||
original = 43 and canonical = 43 and unsigned = -1 and signed = -1 // char16_t
|
||||
or
|
||||
original = 44 and canonical = 44 and unsigned = -1 and signed = -1 // char32_t
|
||||
or
|
||||
original = 51 and canonical = 51 and unsigned = -1 and signed = -1 // char8_t
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -993,6 +997,18 @@ class WideCharType extends IntegralType {
|
||||
override string getCanonicalQLClass() { result = "WideCharType" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The C/C++ `char8_t` type. This is available starting with C++20.
|
||||
* ```
|
||||
* char8_t c8;
|
||||
* ```
|
||||
*/
|
||||
class Char8Type extends IntegralType {
|
||||
Char8Type() { builtintypes(underlyingElement(this), _, 51, _, _, _) }
|
||||
|
||||
override string getCanonicalQLClass() { result = "Char8Type" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The C/C++ `char16_t` type. This is available starting with C11 and C++11.
|
||||
* ```
|
||||
|
||||
@@ -74,6 +74,8 @@ abstract class Architecture extends string {
|
||||
or
|
||||
t instanceof WideCharType and result = wideCharSize()
|
||||
or
|
||||
t instanceof Char8Type and result = 8
|
||||
or
|
||||
t instanceof Char16Type and result = 16
|
||||
or
|
||||
t instanceof Char32Type and result = 32
|
||||
@@ -155,6 +157,8 @@ abstract class Architecture extends string {
|
||||
or
|
||||
t instanceof WideCharType and result = wideCharSize()
|
||||
or
|
||||
t instanceof Char8Type and result = 8
|
||||
or
|
||||
t instanceof Char16Type and result = 16
|
||||
or
|
||||
t instanceof Char32Type and result = 32
|
||||
|
||||
@@ -616,6 +616,7 @@ enumconstants(
|
||||
| 48 = _Float64x
|
||||
| 49 = _Float128
|
||||
| 50 = _Float128x
|
||||
| 51 = char8_t
|
||||
;
|
||||
*/
|
||||
builtintypes(
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
| file://:0:0:0:0 | char32_t |
|
||||
| file://:0:0:0:0 | const |
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
| file://:0:0:0:0 | char32_t |
|
||||
| file://:0:0:0:0 | const |
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
| file://:0:0:0:0 | char32_t |
|
||||
| file://:0:0:0:0 | composite<int> & |
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
| file://:0:0:0:0 | char32_t |
|
||||
| file://:0:0:0:0 | const __va_list_tag |
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
| file://:0:0:0:0 | auto | <none> |
|
||||
| file://:0:0:0:0 | bool | 1 |
|
||||
| file://:0:0:0:0 | char | 1 |
|
||||
| file://:0:0:0:0 | char8_t | 1 |
|
||||
| file://:0:0:0:0 | char16_t | 2 |
|
||||
| file://:0:0:0:0 | char32_t | 4 |
|
||||
| file://:0:0:0:0 | char * | 8 |
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
| 37 | signed __int128 | signed | -------- | explicitlySigned | ------------------ | ---------------- | 16 | 16 | unsigned __int128 | |
|
||||
| 43 | char16_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 2 | 2 | <no unsigned equivalent> | |
|
||||
| 44 | char32_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 4 | 4 | <no unsigned equivalent> | |
|
||||
| 51 | char8_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 1 | 1 | <no unsigned equivalent> | |
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
| 37 | signed __int128 | signed | -------- | explicitlySigned | ------------------ | ---------------- | 16 | 16 | unsigned __int128 | |
|
||||
| 43 | char16_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 2 | 2 | <no unsigned equivalent> | |
|
||||
| 44 | char32_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 4 | 4 | <no unsigned equivalent> | |
|
||||
| 51 | char8_t | ------ | -------- | ---------------- | ------------------ | ---------------- | 1 | 1 | <no unsigned equivalent> | |
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
| file://:0:0:0:0 | auto | Other |
|
||||
| file://:0:0:0:0 | bool | Other |
|
||||
| file://:0:0:0:0 | char | Other |
|
||||
| file://:0:0:0:0 | char8_t | Other |
|
||||
| file://:0:0:0:0 | char16_t | Other |
|
||||
| file://:0:0:0:0 | char32_t | Other |
|
||||
| file://:0:0:0:0 | const | Other |
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
| file://:0:0:0:0 | auto | auto |
|
||||
| file://:0:0:0:0 | bool | bool |
|
||||
| file://:0:0:0:0 | char | char |
|
||||
| file://:0:0:0:0 | char8_t | char8_t |
|
||||
| file://:0:0:0:0 | char16_t | char16_t |
|
||||
| file://:0:0:0:0 | char32_t | char32_t |
|
||||
| file://:0:0:0:0 | const __va_list_tag | __va_list_tag |
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
| auto | AutoType | | | | |
|
||||
| bool | BoolType | | | | |
|
||||
| char | MicrosoftInt8Type, PlainCharType | | | | |
|
||||
| char8_t | Char8Type | | | | |
|
||||
| char16_t | Char16Type | | | | |
|
||||
| char32_t | Char32Type | | | | |
|
||||
| char * | CharPointerType | | char | | |
|
||||
|
||||
2038
cpp/upgrades/d6ca4ebb7680e241b647e78b96999eaf9d84e5b7/old.dbscheme
Normal file
2038
cpp/upgrades/d6ca4ebb7680e241b647e78b96999eaf9d84e5b7/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: Add support for char8_t C++ builtin type
|
||||
compatibility: backwards
|
||||
Reference in New Issue
Block a user