Skip to content

Commit df834ac

Browse files
author
Dave Bartolomeo
committed
C++: Fix duplicate result types
In a couple of cases, we use `glval<unknown>` as the result type of an instruction because we can't come up with anything better. Two examples are the result of `VariableAddress[#ellipsis]`, and the address of the temp variable that holds the lvalue result of the conditional operator in `(a ? b : c) = y`. In both cases, we call `getTypeForGLValue(any(UnknownType t))`, but that would have multiple results because `result.hasType(any(UnknownType t), true)` also holds for `CppFunctionGLValueType`. I tightened the result type to ensure we get the right one.
1 parent b9ecf1a commit df834ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/ql/src/semmle/code/cpp/ir/internal/CppType.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ CppType getTypeForPRValueOrUnknown(Type type) {
362362
/**
363363
* Gets the `CppType` that represents a glvalue of type `type`.
364364
*/
365-
CppType getTypeForGLValue(Type type) { result.hasType(type, true) }
365+
CppGLValueAddressType getTypeForGLValue(Type type) { result.hasType(type, true) }
366366

367367
/**
368368
* Gets the `CppType` that represents a prvalue of type `int`.

0 commit comments

Comments
 (0)