Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e328e78

Browse files
zlaski-semmlegeoffw0
authored andcommitted
[CPP-418] Address @geoffw0's review comments.
1 parent 3fdf84d commit e328e78

2 files changed

Lines changed: 17 additions & 21 deletions

File tree

cpp/ql/src/semmle/code/cpp/Type.qll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
530530

531531
/**
532532
* The C/C++ boolean type. See 4.2. This is the C `_Bool` type
533-
* or the C++ `bool` type. For example,
533+
* or the C++ `bool` type. For example:
534534
* ```
535535
* extern bool a, b; // C++
536536
* _Bool c, d; // C
@@ -545,7 +545,7 @@ class BoolType extends IntegralType {
545545
/**
546546
* The C/C++ character types. See 4.3. This includes the `char`,
547547
* `signed char` and `unsigned char` types, all of which are
548-
* distinct from one another. For example,
548+
* distinct from one another. For example:
549549
* ```
550550
* char a, b;
551551
* signed char c, d;
@@ -556,7 +556,7 @@ abstract class CharType extends IntegralType { }
556556

557557
/**
558558
* The C/C++ `char` type (which is distinct from `signed char` and
559-
* `unsigned char`). For example,
559+
* `unsigned char`). For example:
560560
* ```
561561
* char a, b;
562562
* ```
@@ -841,8 +841,10 @@ class Char32Type extends IntegralType {
841841
}
842842

843843
/**
844-
* The (primitive) type of the C++11 `nullptr` constant. It is the
845-
* unspeakable type given by `decltype(nullptr)`.
844+
* The (primitive) type of the C++11 `nullptr` constant. It is a
845+
* distinct type, denoted by `decltype(nullptr)`, that is not itself a pointer
846+
* type or a pointer to member type. The `<cstddef>` header usually defines
847+
* the `std::nullptr_t` type as follows:
846848
* ```
847849
* typedef decltype(nullptr) nullptr_t;
848850
* ```
@@ -857,12 +859,11 @@ class NullPointerType extends BuiltInType {
857859
* A C/C++ derived type.
858860
*
859861
* These are pointer and reference types, array and GNU vector types, and `const` and `volatile` types.
860-
* In all cases, the type is formed from a single base type. For example,
862+
* In all cases, the type is formed from a single base type. For example:
861863
* ```
862864
* int *pi;
863865
* int &ri = *pi;
864866
* const float fa[40];
865-
* decltype(pi) dpi;
866867
* ```
867868
*/
868869
class DerivedType extends Type, @derivedtype {
@@ -908,7 +909,7 @@ class DerivedType extends Type, @derivedtype {
908909
}
909910

910911
/**
911-
* An instance of the C++11 `decltype` operator. For example,
912+
* An instance of the C++11 `decltype` operator. For example:
912913
* ```
913914
* int a;
914915
* decltype(a) b;
@@ -1165,8 +1166,8 @@ class ArrayType extends DerivedType {
11651166
* In both Clang and GNU compilers, vector types can be introduced using the
11661167
* `__attribute__((vector_size(byte_size)))` syntax. The Clang compiler also
11671168
* allows vector types to be introduced using the `ext_vector_type`,
1168-
* `neon_vector_type`, and `neon_polyvector_typ`e attributes (all of which take
1169-
* an element type rather than a byte size).
1169+
* `neon_vector_type`, and `neon_polyvector_type` attributes (all of which take
1170+
* an element count rather than a byte size).
11701171
* ```
11711172
* typedef int v4si __attribute__ (( vector_size(4*sizeof(int)) ));
11721173
* v4si v = { 1, 2, 3, 4 };

cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class BuiltInOperationIsNothrowAssignable extends BuiltInOperation, @isnothrowas
610610
* The `__is_standard_layout` built-in function (used by some implementations
611611
* of the `<type_traits>` header).
612612
*
613-
* Returns `true` if the type is a primitive type, or a`class`, `struct` or
613+
* Returns `true` if the type is a primitive type, or a `class`, `struct` or
614614
* `union` WITHOUT (1) virtual functions or base classes, (2) reference member
615615
* variable or (3) multiple occurrences of base `class` objects, among other
616616
* restrictions. Please see
@@ -686,8 +686,8 @@ class BuiltInOperationHasTrivialMoveConstructor extends BuiltInOperation,
686686
* (i.e., can be generated by the compiler).
687687
* ```
688688
* template<typename T>
689-
* struct is_trivially_assignable
690-
* : public integral_constant<bool, __is_trivially_assignable(T) >
689+
* struct has_trivial_move_assign
690+
* : public integral_constant<bool, __has_trivial_move_assign(T) >
691691
* { };
692692
* ```
693693
*/
@@ -721,8 +721,8 @@ class BuiltInOperationHasNothrowMoveAssign extends BuiltInOperation, @hasnothrow
721721
* (or none).
722722
* ```
723723
* template<typename T, typename... Args>
724-
* struct is_trivially_constructible
725-
* : public integral_constant<bool, __is_trivially_constructible(T) >
724+
* struct is_constructible
725+
* : public integral_constant<bool, __is_constructible(T) >
726726
* { };
727727
* ```
728728
*/
@@ -851,7 +851,7 @@ class BuiltInOperationIsSealed extends BuiltInOperation, @issealedexpr {
851851
* ref class R {}; // __is_simple_value_class(R) == false
852852
* value struct V {}; // __is_simple_value_class(V) == true
853853
* value struct V2 { // __is_simple_value_class(V2) == false
854-
* R ^ r; // not a simnple value type
854+
* R ^ r; // not a simple value type
855855
* };
856856
* ```
857857
*/
@@ -913,11 +913,6 @@ class BuiltInChooseExpr extends BuiltInOperation, @builtinchooseexpr {
913913

914914
/**
915915
* Fill operation on a vector. This is a GNU extension.
916-
* ```
917-
* typedef float float4 __attribute__((ext_vector_type(4)));
918-
* float4 v4si = (float4){ 1.0, 2.0, 3.0, 4.0 };
919-
*
920-
* ```
921916
*/
922917
class VectorFillOperation extends UnaryOperation, @vec_fill {
923918
override string getOperator() { result = "(vector fill)" }

0 commit comments

Comments
 (0)