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

Skip to content

Commit 8ae0178

Browse files
committed
CPP: Examples Specifier.qll.
1 parent 500097c commit 8ae0178

1 file changed

Lines changed: 32 additions & 7 deletions

File tree

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

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Specifier extends Element, @specifier {
2929

3030
/**
3131
* A C/C++ function specifier: `inline`, `virtual`, or `explicit`.
32+
* TODO
3233
*/
3334
class FunctionSpecifier extends Specifier {
3435
FunctionSpecifier() {
@@ -43,6 +44,7 @@ class FunctionSpecifier extends Specifier {
4344
/**
4445
* A C/C++ storage class specifier: `auto`, `register`, `static`, `extern`,
4546
* or `mutable".
47+
* TODO
4648
*/
4749
class StorageClassSpecifier extends Specifier {
4850
StorageClassSpecifier() {
@@ -58,6 +60,7 @@ class StorageClassSpecifier extends Specifier {
5860

5961
/**
6062
* A C++ access specifier: `public`, `protected`, or `private`.
63+
* TODO
6164
*/
6265
class AccessSpecifier extends Specifier {
6366
AccessSpecifier() {
@@ -146,12 +149,14 @@ class Attribute extends Element, @attribute {
146149
/**
147150
* An attribute introduced by GNU's `__attribute__((name))` syntax, for
148151
* example: `__attribute__((__noreturn__))`.
152+
* TODO
149153
*/
150154
class GnuAttribute extends Attribute, @gnuattribute { }
151155

152156
/**
153157
* An attribute introduced by the C++11 standard `[[name]]` syntax, for
154158
* example: `[[clang::fallthrough]]`.
159+
* TODO
155160
*/
156161
class StdAttribute extends Attribute, @stdattribute {
157162
/**
@@ -171,13 +176,20 @@ class StdAttribute extends Attribute, @stdattribute {
171176
}
172177

173178
/**
174-
* An attribute introduced by Microsoft's `__declspec(name)` syntax, for
175-
* example: `__declspec(dllimport)`.
179+
* An attribute introduced by Microsoft's `__declspec(name)` syntax. For
180+
* example the attribute on the following declaration:
181+
* ```
182+
* __declspec(dllimport) void myFunction();
183+
* ```
176184
*/
177185
class Declspec extends Attribute, @declspec { }
178186

179187
/**
180-
* An attribute introduced by Microsoft's "[name]" syntax, for example "[SA_Pre(Deref=1,Access=SA_Read)]".
188+
* An attribute introduced by Microsoft's "[name]" syntax. For example
189+
* ```
190+
* [SA_Pre(Deref=1,Access=SA_Read)]
191+
* TODO
192+
* ```
181193
*/
182194
class MicrosoftAttribute extends Attribute, @msattribute {
183195
AttributeArgument getNamedArgument(string name) {
@@ -186,8 +198,13 @@ class MicrosoftAttribute extends Attribute, @msattribute {
186198
}
187199

188200
/**
189-
* A C++11 `alignas` construct.
190-
*
201+
* A C++11 `alignas` construct. For example the attribute in the following
202+
* code:
203+
* ```
204+
* struct alignas(16) MyStruct {
205+
* int x;
206+
* };
207+
* ```
191208
* Though it doesn't use the attribute syntax, `alignas(...)` is presented
192209
* as an `Attribute` for consistency with the `[[align(...)]]` attribute.
193210
*/
@@ -197,7 +214,11 @@ class AlignAs extends Attribute, @alignas {
197214

198215
/**
199216
* A GNU `format` attribute of the form `__attribute__((format(archetype, format-index, first-arg)))`
200-
* that declares a function to accept a `printf` style format string.
217+
* that declares a function to accept a `printf` style format string. For example the attribute
218+
* on the following declaration:
219+
* ```
220+
* int myPrintf(const char *format, ...) __attribute__((format(printf, 1, 2)));
221+
* ```
201222
*/
202223
class FormatAttribute extends GnuAttribute {
203224
FormatAttribute() { getName() = "format" }
@@ -242,7 +263,11 @@ class FormatAttribute extends GnuAttribute {
242263
}
243264

244265
/**
245-
* An argument to an `Attribute`.
266+
* An argument to an `Attribute`. For example the argument "dllimport" on the
267+
* attribute in the following code:
268+
* ```
269+
* __declspec(dllimport) void myFunction();
270+
* ```
246271
*/
247272
class AttributeArgument extends Element, @attribute_arg {
248273
/**

0 commit comments

Comments
 (0)