Skip to content

Commit b1a2470

Browse files
jf205felicitymayshati-patel
authored andcommitted
Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com> Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
1 parent 6ff1c99 commit b1a2470

5 files changed

Lines changed: 10 additions & 15 deletions

File tree

docs/language/learn-ql/cpp/guards.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Using the guards library in C and C++
22
=====================================
33

4-
You can use the CodeQL guards library to identify conditional expressions that control the execution of other code in C and C++ codebases.
4+
You can use the CodeQL guards library to identify conditional expressions that control the execution of other parts of a program in C and C++ codebases.
55

66
About the guards library
77
------------------------

docs/language/learn-ql/cpp/introduce-libraries-cpp.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
CodeQL libraries for C and C++
2-
==============================
1+
CodeQL library for C and C++
2+
============================
33

4-
Explore the standard CodeQL libraries for C and C++.
4+
When analyzing C or C++ code, you can use the large collection of classes in the CodeQL library for C and C++.
55

6-
About the CodeQL libraries for C and C++
7-
----------------------------------------
6+
About the CodeQL library for C and C++
7+
--------------------------------------
88

99
There is an extensive library for analyzing CodeQL databases extracted from C/C++ projects. The classes in this library present the data from a database in an object-oriented form and provide abstractions and predicates to help you with common analysis tasks.
1010
The library is implemented as a set of QL modules, that is, files with the extension ``.qll``. The module ``cpp.qll`` imports all the core C/C++ library modules, so you can include the complete library by beginning your query with:
@@ -15,10 +15,6 @@ The library is implemented as a set of QL modules, that is, files with the exten
1515
1616
The rest of this topic summarizes the available CodeQL classes and corresponding C/C++ constructs.
1717

18-
.. pull-quote:: Note
19-
20-
You can find related classes and features using the query console's auto-complete feature. You can also press *F3* to jump to the definition of any element. Library files are opened in new tabs in the console.
21-
2218
Commonly-used library classes
2319
------------------------------
2420

docs/language/learn-ql/cpp/private-field-initialization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Refining a query to account for edge cases
22
==========================================
33

4-
You can improve the results generated by a CodeQL query by adding conditions to remove false positives caused by common edge cases.
4+
You can improve the results generated by a CodeQL query by adding conditions to remove false positive results caused by common edge cases.
55

66
Overview
77
--------
@@ -126,7 +126,7 @@ This case can be excluded by creating a recursive predicate. The recursive predi
126126
Refinement 4—simplifying the query
127127
----------------------------------
128128

129-
Finally we can simplify the query by using the transitive closure operator. In this final version of the query, ``c.calls*(fun)`` resolves to the set of all functions that are ``c`` itself, are called by ``c``, are called by a function that is called by ``c``, and so on. This eliminates the need to make a new predicate all together. For more information, see `transitive closures <https://help.semmle.com/QL/ql-handbook/recursion.html#transitive-closures>`__ in the QL language handbook.
129+
Finally we can simplify the query by using the transitive closure operator. In this final version of the query, ``c.calls*(fun)`` resolves to the set of all functions that are ``c`` itself, are called by ``c``, are called by a function that is called by ``c``, and so on. This eliminates the need to make a new predicate all together. For more information, see `Transitive closures <https://help.semmle.com/QL/ql-handbook/recursion.html#transitive-closures>`__ in the QL language handbook.
130130

131131
.. code-block:: ql
132132

docs/language/learn-ql/cpp/value-numbering-hash-cons.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ About the hash consing and value numbering libraries
88

99
In C and C++ databases, each node in the abstract syntax tree is represented by a separate object. This allows both analysis and results display to refer to specific appearances of a piece of syntax. However, it is frequently useful to determine whether two expressions are equivalent, either syntactically or semantically.
1010

11-
The hash consing library (defined in ``semmle.code.cpp.valuenumbering.HashCons``) provides a mechanism for identifying expressions that have the same syntactic structure. The global value numbering library (defined in ``semmle.code.cpp.valuenumbering.GlobalValueNumbering``) provides a mechanism for identifying expressions that compute the same value at runtime. Both libraries partition the expressions in each function into equivalence classes represented by objects. Each ``HashCons`` object represents a set of expressions with identical parse trees, while ``GVN`` objects represent sets of expressions that will always compute the same value. For more information, see `hash consing <https://en.wikipedia.org/wiki/Hash_consing>`__ and `value numbering <https://en.wikipedia.org/wiki/Value_numbering>`__ on Wikipedia.
11+
The hash consing library (defined in ``semmle.code.cpp.valuenumbering.HashCons``) provides a mechanism for identifying expressions that have the same syntactic structure. The global value numbering library (defined in ``semmle.code.cpp.valuenumbering.GlobalValueNumbering``) provides a mechanism for identifying expressions that compute the same value at runtime. Both libraries partition the expressions in each function into equivalence classes represented by objects. Each ``HashCons`` object represents a set of expressions with identical parse trees, while ``GVN`` objects represent sets of expressions that will always compute the same value. For more information, see `Hash consing <https://en.wikipedia.org/wiki/Hash_consing>`__ and `Value numbering <https://en.wikipedia.org/wiki/Value_numbering>`__ on Wikipedia.
1212

1313
Example C code
1414
--------------
@@ -110,4 +110,3 @@ Example query
110110
hashCons(outer.getCondition()) = hashCons(inner.getCondition())
111111
select inner.getCondition(), "The condition of this if statement duplicates the condition of $@",
112112
outer.getCondition(), "an enclosing if statement"
113-

docs/language/learn-ql/cpp/zero-space-terminator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ When you have defined the basic query then you can refine the query to include f
100100
Improving the query using the 'SSA' library
101101
-------------------------------------------
102102

103-
The ``SSA`` library represents variables in static single assignment (SSA) form. In this form, each variable is assigned exactly once and every variable is defined before it is used. The use of SSA variables simplifies queries considerably as much of the local data flow analysis has been done for us. For more information, see `static single assignment <http://en.wikipedia.org/wiki/Static_single_assignment_form>`__ on Wikipedia.
103+
The ``SSA`` library represents variables in static single assignment (SSA) form. In this form, each variable is assigned exactly once and every variable is defined before it is used. The use of SSA variables simplifies queries considerably as much of the local data flow analysis has been done for us. For more information, see `Static single assignment <http://en.wikipedia.org/wiki/Static_single_assignment_form>`__ on Wikipedia.
104104

105105
Including examples where the string size is stored before use
106106
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)