Skip to content

CPP: QLDoc enhancements #2309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f54e0d0
[CPP-418] Initial modifications to Type.qll. To be continued.
zlaski-semmle Aug 26, 2019
1f35f4b
[CPP-418] Add descriptions for QL classes in Type.qll. (Still need t…
zlaski-semmle Sep 2, 2019
b0a9348
[CPP-418] Add QLDoc entries for typedef types, user types, bitwise op…
zlaski-semmle Sep 5, 2019
3fdf84d
[CPP-418] Logical and comparison operators; reformat built-ins.
zlaski-semmle Sep 6, 2019
e328e78
[CPP-418] Address @geoffw0's review comments.
zlaski-semmle Sep 6, 2019
113481d
[CPP-418] Add concrete syntax for arithmetic operation, EXCEPT for as…
zlaski-semmle Sep 8, 2019
ecb700c
[CPP-418] Some assignments and call expressions. Some could not be d…
zlaski-semmle Sep 9, 2019
8965561
[CPP-418] Tweak vector initializer syntax.
zlaski-semmle Sep 9, 2019
f255977
[CPP-418] Some more complex numbers, vectors.
zlaski-semmle Sep 9, 2019
09f538a
[CPP-418] Merge detritus.
zlaski-semmle Sep 10, 2019
e647dc3
[CPP-418] Fill in examples for ErroneousType, UnknownType, and
zlaski-semmle Sep 10, 2019
98eca47
[CPP-418] Calls, casts, assignments and other goodness.
zlaski-semmle Sep 13, 2019
1f337e9
[CPP-418] Typo.
zlaski-semmle Sep 13, 2019
e2d5a82
[CPP-418] Expressions.
zlaski-semmle Sep 15, 2019
6eac51d
[CPP-418] Address review comments.
zlaski-semmle Sep 16, 2019
faf4342
[CPP-418] Update references to BuiltInOperationBuiltInOffsetOf and __…
zlaski-semmle Sep 16, 2019
2baa748
Address further review comments.
zlaski-semmle Sep 17, 2019
20e28b8
[CPP-418] Reformat.
zlaski-semmle Sep 17, 2019
d0069fc
[CPP-418] Literals.
zlaski-semmle Sep 20, 2019
5cc92b7
[CPP-418] Mention that GNU vector initializers are syntactically
zlaski-semmle Sep 23, 2019
a5d2fbd
CPP: Resolve remaining comments from the original PR.
geoffw0 Nov 13, 2019
93b4985
CPP: Backticks.
geoffw0 Nov 13, 2019
86bea78
CPP: Fix bad merge.
geoffw0 Nov 13, 2019
abcf9e0
CPP: Autoformat.
geoffw0 Nov 13, 2019
4c6fd00
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 13, 2019
da6fa7a
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 13, 2019
5e15265
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 13, 2019
e883220
CPP: Remove other comments about equivalence.
geoffw0 Nov 13, 2019
e72bf2d
CPP: *lvalue* -> _lvalue_ and similar.
geoffw0 Nov 13, 2019
2b73af0
CPP: Consistency.
geoffw0 Nov 13, 2019
44ffb60
CPP: Improve the UnknwonType example as suggested.
geoffw0 Nov 13, 2019
9755985
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 14, 2019
7d2babd
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 14, 2019
90909d2
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 14, 2019
b3bda42
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 14, 2019
238918c
Update cpp/ql/src/semmle/code/cpp/Type.qll
geoffw0 Nov 14, 2019
01b2519
CPP: Lesser than -> Less than.
geoffw0 Nov 14, 2019
25db900
Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
geoffw0 Nov 14, 2019
0f2a2cb
Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
geoffw0 Nov 14, 2019
79a000d
Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
geoffw0 Nov 14, 2019
b1dfc60
Update cpp/ql/src/semmle/code/cpp/exprs/Cast.qll
geoffw0 Nov 14, 2019
acefadd
Update cpp/ql/src/semmle/code/cpp/exprs/Assignment.qll
geoffw0 Nov 14, 2019
877e9ba
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
d8aeedf
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
fe5bd42
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
6262cee
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
82c6ff0
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
f96cffa
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
8b30baf
CPP: Delete 'compiler-generated'.
geoffw0 Nov 14, 2019
0bb37c1
CPP: Delete parenthesized comment.
geoffw0 Nov 14, 2019
45cc6c4
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
6724632
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
beb3602
Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
geoffw0 Nov 14, 2019
f2b7af7
CPP: Add example code for RoutineType.
geoffw0 Nov 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
346 changes: 286 additions & 60 deletions cpp/ql/src/semmle/code/cpp/Type.qll

Large diffs are not rendered by default.

33 changes: 23 additions & 10 deletions cpp/ql/src/semmle/code/cpp/TypedefType.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import semmle.code.cpp.Type
private import semmle.code.cpp.internal.ResolveClass

/**
* A C/C++ typedef type. See 4.9.1.
*
* Represents either of the following typedef styles:
*
* * CTypedefType: typedef <type> <name>;
* * UsingAliasTypedefType: using <name> = <type>;
* A C/C++ typedef type. See 4.9.1. For example the types declared on each line of the following code:
* ```
* typedef int my_int;
* using my_int2 = int;
* ```
*/
class TypedefType extends UserType {
TypedefType() {
Expand Down Expand Up @@ -48,7 +47,10 @@ class TypedefType extends UserType {
}

/**
* A traditional C/C++ typedef type. See 4.9.1.
* A traditional C/C++ typedef type. See 4.9.1. For example the type declared in the following code:
* ```
* typedef int my_int;
* ```
*/
class CTypedefType extends TypedefType {
CTypedefType() { usertypes(underlyingElement(this), _, 5) }
Expand All @@ -61,7 +63,10 @@ class CTypedefType extends TypedefType {
}

/**
* A using alias C++ typedef type.
* A using alias C++ typedef type. For example the type declared in the following code:
* ```
* using my_int2 = int;
* ```
*/
class UsingAliasTypedefType extends TypedefType {
UsingAliasTypedefType() { usertypes(underlyingElement(this), _, 14) }
Expand All @@ -74,7 +79,11 @@ class UsingAliasTypedefType extends TypedefType {
}

/**
* A C++ typedef type that is directly enclosed by a function.
* A C++ `typedef` type that is directly enclosed by a function. For example the type declared inside the function `foo` in
* the following code:
* ```
* int foo(void) { typedef int local; }
* ```
*/
class LocalTypedefType extends TypedefType {
LocalTypedefType() { isLocal() }
Expand All @@ -83,7 +92,11 @@ class LocalTypedefType extends TypedefType {
}

/**
* A C++ typedef type that is directly enclosed by a class, struct or union.
* A C++ `typedef` type that is directly enclosed by a `class`, `struct` or `union`. For example the type declared inside
* the class `C` in the following code:
* ```
* class C { typedef int nested; };
* ```
*/
class NestedTypedefType extends TypedefType {
NestedTypedefType() { this.isMember() }
Expand Down
14 changes: 12 additions & 2 deletions cpp/ql/src/semmle/code/cpp/UserType.qll
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ import semmle.code.cpp.Function
private import semmle.code.cpp.internal.ResolveClass

/**
* A C/C++ user-defined type. Examples include `Class`, `Struct`, `Union`,
* `Enum`, and `TypedefType`.
* A C/C++ user-defined type. Examples include `class`, `struct`, `union`,
* `enum` and `typedef` types.
* ```
* enum e1 { val1, val2 } b;
* enum class e2: short { val3, val4 } c;
* typedef int my_int;
* class C { int a, b; };
* ```
*/
class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @usertype {
/**
Expand Down Expand Up @@ -88,6 +94,10 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @

/**
* A particular definition or forward declaration of a C/C++ user-defined type.
* ```
* class C;
* typedef int ti;
* ```
*/
class TypeDeclarationEntry extends DeclarationEntry, @type_decl {
override UserType getDeclaration() { result = getType() }
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/src/semmle/code/cpp/commons/Buffer.qll
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ predicate memberMayBeVarSize(Class c, MemberVariable v) {
aoe.getAddressable() = v
)
or
exists(BuiltInOperationOffsetOf oo |
exists(BuiltInOperationBuiltInOffsetOf oo |
// `offsetof(c, v)` using a builtin
oo.getAChild().(VariableAccess).getTarget() = v
)
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/src/semmle/code/cpp/controlflow/internal/CFG.qll
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private predicate excludeNodeAndNodesBelow(Expr e) {
* control flow in them.
*/
private predicate excludeNodesStrictlyBelow(Node n) {
n instanceof BuiltInOperationOffsetOf
n instanceof BuiltInOperationBuiltInOffsetOf
or
n instanceof BuiltInIntAddr
or
Expand Down
Loading