-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Add support for more clang builtins #17311
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
21a741a
to
08afe5d
Compare
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.
Approach LGTM - would have expected __datasizeof
rather than sizeof
in the toString()
but perhaps there is a good reason for this.
/** Gets the contained expression. */ | ||
Expr getExprOperand() { result = this.getChild(0) } | ||
|
||
override string toString() { result = "sizeof(<expr>)" } |
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 this should be __datasizeof
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.
Fixed. A bit too much copy&paste.
/** Gets the contained type. */ | ||
Type getTypeOperand() { sizeof_bind(underlyingElement(this), unresolveElement(result)) } | ||
|
||
override string toString() { result = "sizeof(" + this.getTypeOperand().getName() + ")" } |
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.
__datasizeof
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.
Fixed.
* A C++ `__datasizeof` expression (used by some implementations | ||
* of the `<type_traits>` header). | ||
* | ||
* The `__datasizeof` expression behaves identical to `sizeof` except |
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.
Nit: identically
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.
Fixed.
@@ -0,0 +1,10 @@ | |||
import cpp | |||
|
|||
from DatasizeofOperator sto, string elemDesc, Element e |
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.
Question: Would it be helpful to also output the constant value of the expression?
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.
Added. Also for the sizeof
test from which this was copied.
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.
Great!
No description provided.