-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[CPP-387] Create a new PR against new location of introduce-libraries… #1658
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
Conversation
… it is redundant and may lead to documentation inconsistencies.
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Declaration syntax | QL class | Remarks | | ||
+=============================================================================================================================================================================================================================================================================================================================================================================================================================================+=======================================================================================================================================================================+===================================================================================================================================================================================================================================================================================+ | ||
| ``enum`` ``{`` *enum_constant1* ``,`` *enum_constant2* ``,`` *enum_constant3* ``}`` | `EnumConstant <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Enum.qll/type.Enum$EnumConstant.html>`__ | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the simplest way for me to see what this will look like when it's rendered?
How complete is this PR at the moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say it is 80% done. Formatting is totally inconsistent and still a bit in the air as far as what conventions should be used (feedback welcome). I've pasted the link to the file below.
So I have committed the first, very rough draft of the document. It will be much easier for you to look at the rendered document (https://github.com/zlaski-semmle/ql/blob/zlaski/cpp387/docs/ql-documentation/learn-ql/cpp/introduce-libraries-cpp.rst) instead of analyzing the diffs. @james, @jbj, @dave-bartolomeo, @rdmarsh2 @geoffw0 , please give me feedback regarding formatting (esp. wrt the C/C++ code snippets), structure, and which QL class entries should be removed or are missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts.
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Declaration syntax | QL class | Remarks | | ||
+=============================================================================================================================================================================================================================================================================================================================================================================================================================================+=======================================================================================================================================================================+===================================================================================================================================================================================================================================================================================+ | ||
| ``enum`` ``{`` **enum_constant1** ``,`` **enum_constant2** ``,`` **enum_constant3** ``}`` | `EnumConstant <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Enum.qll/type.Enum$EnumConstant.html>`__ | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are certain words such as "enum_constant1" and (later) "strcat" bold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the formatting has still not been formalized. Which of the various "styles" contained in the document are preferable to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer when the declaration syntax is all in a monospaced font, with no bold or italics. Bolding the element in question (as in strcat
) also looks reasonable to me. Consistency is important though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be aware that unfortunately rst does not support nested inline mark up. So, for example, you can't have text that is both monospace and bold.
As we discussed in the Hangout, I'd like to see all the named functions ( |
More progress. Attempts to create bold monospace have failed.
This requires rebasing to fix the conflicts, as the |
Why do you write |
…nto zlaski-semmle-zlaski/cpp387 Conflict resolution step as per GitHub PR page
Conflict resolution step as per GitHub PR page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are my comments after a first pass of going over this in some detail. I think another pass will be needed, both by yourself and by someone else.
But first let's figure out the formatting. Since @jf205 points out that we can't have bold monospace text, I'm withdrawing my opinion that the element in focus should be bold-face. It looks strange to have a mix of monospace and variable-width text. The inspiration all along has been JavaScript's overview page, and I still find JavaScript's overview page to pleasant to read.
I think now that the reason why the examples are so complicated is that you've attempted to make an injective mapping from QL class to surface syntax, whereas I think it would be more helpful as a map from surface syntax to QL classes. For example, I'd have just one entry for a - b
, and its QL class column would have both SubExpr
, PointerDiffExpr
, and PointerSubExpr
. This is the overview page, and it should be helpful to users who know C++ but don't know the QL C++ library.
Before you iterate more on this, let's discuss it in a Hangout to make sure we're on the same page.
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This +
should be ++
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where?
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not write this as nullptr_t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me at the rendered document? I'm not sure what you're referring to.
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntPointerType
is an example of a type that's far too specific and ad hoc to be documented here. I suggest we remove all items from the semmle/code/cpp/commons
directory. What do you think, @geoffw0 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps FormattingFunction
/ FormattingFunctionCall
are useful enough to be worth documenting here, but with that possible exception I agree about commons
.
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GNU extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where?
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GNU extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where?
| **union U** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant1** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **variant2** ``,`` ... ``};`` | `Union <hhttps://help.semmle.com/qldoc/cpp/semmle/code/cpp/Union.qll/type.Union$Union.html>`__ | | | ||
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| **struct S** ``{`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_variable** ``;`` `Type <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Type.qll/type.Type$Type.html>`__ **member_function** ``(`` `Parameter <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Parameter.qll/type.Parameter$Parameter.html>`__ ... ``) {`` ... ``}``... ``};`` | `Struct <https://help.semmle.com/qldoc/cpp/semmle/code/cpp/Struct.qll/type.Struct$Struct.html>`__ | | | ||
+------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's helpful to mention ptrdiff_t
here, especially not in bold-face. It's not obvious that the relevant item in this example is the -
and not something else.
I can see that GitHub is also confused about which lines my review comments should be on. It looks correct on the Files tab. |
@zlaski-semmle My comments are no longer visible on the Files tab after the latest pushes, but this url still shows all my comments in the right place. |
I removed the |
I haven't finished reviewing, but this is what I have so far.
|
I've gotten rid of all the "commons" QL classes, but kept |
@jbj, I'm puzzled by your constructor suggestion. People definitely write |
Okay. Then let's keep it that way, as long as it's deliberate. |
Okay, I finally went through the whole thing from top to bottom.
|
I'll try responding on a per-bullet-point basis.
|
The problem with I agree we need to represent class inheritance on the overview page. For that, you need to add the
I don't think there's value in varying the meta-syntax used in the examples. I think "Type" (as a link) would be most consistent with the rest of the page and with the JavaScript page. But don't change it now if it's a hassle.
Sorry, my question was rhetorical and meant as an example of what a reader might ask themselves. My suggestion is to simply omit the members and write
I only noticed just now that you've documented a class named
Are you sure the examples you wrote will actually produce a |
Since we just found out that |
It turns out there is a |
To be clear, I'm not advocating that all these classes should be on the overview page. I'm just proposing it as a way to check whether we might have missed one or two classes. The |
I did have a methodology for choosing which QL classes to document: starting with For purposes of our overview, I guess I'll treat |
When constructing the doc for Looking back at the QLDoc, it seems that
which compiles fine with GCC and Clang, but PrintAST.qll does not produce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for putting up with all these iterations of review!
@jf205: I've merged this PR. What's the next step in getting it deployed? |
@jbj and @zlaski-semmle: thanks for getting this merged. The next step is to manually publish this on help.semmle.com. There are a couple more PRs that I would like to get merged before doing this, so I expect it will happen towards the end of the week, if that is ok for you? |
That's perfectly fine. |
This week is fine. Please let me know what you need me to do. |
…-cpp.rst.
Previous PR was https://git.semmle.com/Semmle/code/pull/33238