Skip to content
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
08a5136
[CPP-418] Initial modifications to Type.qll. To be continued.
zlaski-semmle Aug 26, 2019
fcf1119
[CPP-418] Add descriptions for QL classes in Type.qll. (Still need t…
zlaski-semmle Sep 2, 2019
50cce25
[CPP-418] Add QLDoc entries for typedef types, user types, bitwise op…
zlaski-semmle Sep 5, 2019
653344c
[CPP-418] Logical and comparison operators; reformat built-ins.
zlaski-semmle Sep 6, 2019
9206c2f
[CPP-418] Address @geoffw0's review comments.
zlaski-semmle Sep 6, 2019
c77d9a5
[CPP-418] Add concrete syntax for arithmetic operation, EXCEPT for as…
zlaski-semmle Sep 8, 2019
fe60660
[CPP-418] Some assignments and call expressions. Some could not be d…
zlaski-semmle Sep 9, 2019
b62707d
[CPP-418] Tweak vector initializer syntax.
zlaski-semmle Sep 9, 2019
ee9cced
[CPP-418] Some more complex numbers, vectors.
zlaski-semmle Sep 9, 2019
08368cd
[CPP-418] Merge detritus.
zlaski-semmle Sep 10, 2019
9e0069c
[CPP-418] Fill in examples for ErroneousType, UnknownType, and
zlaski-semmle Sep 10, 2019
37cfbb0
[CPP-418] Calls, casts, assignments and other goodness.
zlaski-semmle Sep 13, 2019
6703c7b
[CPP-418] Typo.
zlaski-semmle Sep 13, 2019
e45938f
[CPP-418] Expressions.
zlaski-semmle Sep 15, 2019
50a3791
[CPP-418] Address review comments.
zlaski-semmle Sep 16, 2019
93140c6
[CPP-418] Update references to BuiltInOperationBuiltInOffsetOf and __…
zlaski-semmle Sep 16, 2019
39afeda
Address further review comments.
zlaski-semmle Sep 17, 2019
d5d8425
[CPP-418] Reformat.
zlaski-semmle Sep 17, 2019
516f524
[CPP-418] Literals.
zlaski-semmle Sep 20, 2019
b306c72
[CPP-418] Mention that GNU vector initializers are syntactically
zlaski-semmle Sep 23, 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
338 changes: 278 additions & 60 deletions cpp/ql/src/semmle/code/cpp/Type.qll

Large diffs are not rendered by default.

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

/**
* A C/C++ typedef type. See 4.9.1.
* A C/C++ `typedef` type. See 4.9.1.
* ```
* typedef int my_int;
* ```
*/
class TypedefType extends UserType {
TypedefType() { usertypes(underlyingElement(this), _, 5) }
Expand Down Expand Up @@ -46,7 +49,10 @@ class TypedefType extends UserType {
}

/**
* A C++ typedef type that is directly enclosed by a function.
* A C++ `typedef` type that is directly enclosed by a function.
* ```
* int foo(void) { typedef int local; }
* ```
*/
class LocalTypedefType extends TypedefType {
LocalTypedefType() { isLocal() }
Expand All @@ -55,7 +61,10 @@ 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`.
* ```
* 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