Skip to content

Commit f045035

Browse files
committed
CPP: Examples Include.qll.
1 parent a889a79 commit f045035

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import semmle.code.cpp.Preprocessor
22

33
/**
44
* A C/C++ `#include`, `#include_next`, or `#import` preprocessor
5-
* directive.
5+
* directive. The following example contains four different `Include`
6+
* directives:
7+
* ```
8+
* #include "header.h"
9+
* #include <string>
10+
* #include_next <header2.h>
11+
* #import <header3.h>
12+
* ```
613
*/
714
class Include extends PreprocessorDirective, @ppd_include {
815
override string toString() { result = "#include " + this.getIncludeText() }
@@ -37,7 +44,10 @@ class Include extends PreprocessorDirective, @ppd_include {
3744

3845
/**
3946
* A `#include_next` preprocessor directive (a non-standard extension to
40-
* C/C++).
47+
* C/C++). For example the following code contains one `IncludeNext` directive:
48+
* ```
49+
* #include_next <header2.h>
50+
* ```
4151
*/
4252
class IncludeNext extends Include, @ppd_include_next {
4353
override string toString() {
@@ -47,7 +57,11 @@ class IncludeNext extends Include, @ppd_include_next {
4757

4858
/**
4959
* A `#import` preprocessor directive (used heavily in Objective C, and
50-
* supported by GCC as an extension in C).
60+
* supported by GCC as an extension in C). For example the following code
61+
* contains one `Import` directive:
62+
* ```
63+
* #import <header3.h>
64+
* ```
5165
*/
5266
class Import extends Include, @ppd_objc_import {
5367
override string toString() {

0 commit comments

Comments
 (0)