mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: handle __uuidof(0)
This commit is contained in:
@@ -497,7 +497,12 @@ class DynamicCast extends Cast, @dynamic_cast {
|
||||
* specified by the `__declspec(uuid)` attribute.
|
||||
*/
|
||||
class UuidofOperator extends Expr, @uuidof {
|
||||
override string toString() { result = "__uuidof(" + getTypeOperand().getName() + ")" }
|
||||
override string toString() {
|
||||
if exists(getTypeOperand()) then
|
||||
result = "__uuidof(" + getTypeOperand().getName() + ")"
|
||||
else
|
||||
result = "__uuidof(0)"
|
||||
}
|
||||
|
||||
override int getPrecedence() { result = 15 }
|
||||
|
||||
|
||||
@@ -15,5 +15,6 @@ void GetUUID() {
|
||||
uuid = __uuidof(Templ<S>);
|
||||
S s;
|
||||
uuid = __uuidof(s);
|
||||
uuid = __uuidof(0);
|
||||
}
|
||||
// semmle-extractor-options: --microsoft
|
||||
|
||||
@@ -11,3 +11,4 @@ uuidofOperators
|
||||
| uuidof.cpp:14:12:14:30 | __uuidof(S) | const _GUID | 01234567-89ab-cdef-0123-456789abcdef |
|
||||
| uuidof.cpp:15:12:15:29 | __uuidof(S) | const _GUID | 01234567-89ab-cdef-0123-456789abcdef |
|
||||
| uuidof.cpp:17:12:17:22 | __uuidof(S) | const _GUID | 01234567-89ab-cdef-0123-456789abcdef |
|
||||
| uuidof.cpp:18:12:18:22 | __uuidof(0) | const _GUID | 00000000-0000-0000-0000-000000000000 |
|
||||
|
||||
Reference in New Issue
Block a user