mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C++: Address review comments
This commit is contained in:
@@ -381,6 +381,14 @@ abstract class TranslatedValueCategoryAdjustment extends TranslatedExpr {
|
||||
final TranslatedCoreExpr getOperand() { result.getExpr() = expr }
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `expr` requires an `SehExceptionEdge` to be generated.
|
||||
*/
|
||||
private predicate hasSehExceptionEdge(Expr expr) {
|
||||
expr instanceof PointerDereferenceExpr and
|
||||
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*())
|
||||
}
|
||||
|
||||
/**
|
||||
* IR translation of an implicit lvalue-to-rvalue conversion on the result of
|
||||
* an expression.
|
||||
@@ -403,9 +411,8 @@ class TranslatedLoad extends TranslatedValueCategoryAdjustment, TTranslatedLoad
|
||||
(
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
or
|
||||
expr instanceof PointerDereferenceExpr and
|
||||
hasSehExceptionEdge(expr) and
|
||||
kind instanceof SehExceptionEdge and
|
||||
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
|
||||
result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge e))
|
||||
)
|
||||
}
|
||||
@@ -1955,9 +1962,8 @@ class TranslatedAssignExpr extends TranslatedNonConstantExpr {
|
||||
(
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
or
|
||||
expr.getLValue() instanceof PointerDereferenceExpr and
|
||||
hasSehExceptionEdge(expr.getLValue()) and
|
||||
kind instanceof SehExceptionEdge and
|
||||
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
|
||||
result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge e))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49689,7 +49689,7 @@ try_except.c:
|
||||
# 52| Type = [IntType] int
|
||||
# 52| ValueCategory = prvalue(load)
|
||||
# 54| getStmt(2): [ReturnStmt] return ...
|
||||
# 56| [TopLevelFunction] void k(int*, int*, int*, int*, int*)
|
||||
# 56| [TopLevelFunction] void k(int*, int*, int*)
|
||||
# 56| <params>:
|
||||
# 56| getParameter(0): [Parameter] b
|
||||
# 56| Type = [IntPointerType] int *
|
||||
@@ -49697,10 +49697,6 @@ try_except.c:
|
||||
# 56| Type = [IntPointerType] int *
|
||||
# 56| getParameter(2): [Parameter] d
|
||||
# 56| Type = [IntPointerType] int *
|
||||
# 56| getParameter(3): [Parameter] e
|
||||
# 56| Type = [IntPointerType] int *
|
||||
# 56| getParameter(4): [Parameter] f
|
||||
# 56| Type = [IntPointerType] int *
|
||||
# 56| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 57| getStmt(0): [DeclStmt] declaration
|
||||
# 57| getDeclarationEntry(0): [VariableDeclarationEntry] definition of x
|
||||
|
||||
@@ -39258,7 +39258,7 @@ try_except.c:
|
||||
# 46| Block 7
|
||||
# 46| v46_10(void) = Unreached :
|
||||
|
||||
# 56| void k(int*, int*, int*, int*, int*)
|
||||
# 56| void k(int*, int*, int*)
|
||||
# 56| Block 0
|
||||
# 56| v56_1(void) = EnterFunction :
|
||||
# 56| m56_2(unknown) = AliasedDefinition :
|
||||
@@ -39276,14 +39276,6 @@ try_except.c:
|
||||
# 56| m56_14(int *) = InitializeParameter[d] : &:r56_13
|
||||
# 56| r56_15(int *) = Load[d] : &:r56_13, m56_14
|
||||
# 56| m56_16(unknown) = InitializeIndirection[d] : &:r56_15
|
||||
# 56| r56_17(glval<int *>) = VariableAddress[e] :
|
||||
# 56| m56_18(int *) = InitializeParameter[e] : &:r56_17
|
||||
# 56| r56_19(int *) = Load[e] : &:r56_17, m56_18
|
||||
# 56| m56_20(unknown) = InitializeIndirection[e] : &:r56_19
|
||||
# 56| r56_21(glval<int *>) = VariableAddress[f] :
|
||||
# 56| m56_22(int *) = InitializeParameter[f] : &:r56_21
|
||||
# 56| r56_23(int *) = Load[f] : &:r56_21, m56_22
|
||||
# 56| m56_24(unknown) = InitializeIndirection[f] : &:r56_23
|
||||
# 57| r57_1(glval<int>) = VariableAddress[x] :
|
||||
# 57| r57_2(int) = Constant[0] :
|
||||
# 57| m57_3(int) = Store[x] : &:r57_1, r57_2
|
||||
@@ -39355,17 +39347,15 @@ try_except.c:
|
||||
# 66| m66_1(unknown) = Phi : from 3:m60_7, from 7:m63_7
|
||||
# 66| m66_2(unknown) = Phi : from 3:~m56_4, from 7:~m64_6
|
||||
# 66| v66_3(void) = NoOp :
|
||||
# 56| v56_25(void) = ReturnIndirection[b] : &:r56_7, m56_8
|
||||
# 56| v56_26(void) = ReturnIndirection[c] : &:r56_11, m66_1
|
||||
# 56| v56_27(void) = ReturnIndirection[d] : &:r56_15, m56_16
|
||||
# 56| v56_28(void) = ReturnIndirection[e] : &:r56_19, m56_20
|
||||
# 56| v56_29(void) = ReturnIndirection[f] : &:r56_23, m56_24
|
||||
# 56| v56_30(void) = ReturnVoid :
|
||||
# 56| v56_31(void) = AliasedUse : ~m66_2
|
||||
# 56| v56_32(void) = ExitFunction :
|
||||
# 56| v56_17(void) = ReturnIndirection[b] : &:r56_7, m56_8
|
||||
# 56| v56_18(void) = ReturnIndirection[c] : &:r56_11, m66_1
|
||||
# 56| v56_19(void) = ReturnIndirection[d] : &:r56_15, m56_16
|
||||
# 56| v56_20(void) = ReturnVoid :
|
||||
# 56| v56_21(void) = AliasedUse : ~m66_2
|
||||
# 56| v56_22(void) = ExitFunction :
|
||||
|
||||
# 56| Block 9
|
||||
# 56| v56_33(void) = Unreached :
|
||||
# 56| v56_23(void) = Unreached :
|
||||
|
||||
try_except.cpp:
|
||||
# 6| void f_cpp()
|
||||
|
||||
@@ -37533,7 +37533,7 @@ try_except.c:
|
||||
# 46| v46_9(void) = ReturnVoid :
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 56| void k(int*, int*, int*, int*, int*)
|
||||
# 56| void k(int*, int*, int*)
|
||||
# 56| Block 0
|
||||
# 56| v56_1(void) = EnterFunction :
|
||||
# 56| mu56_2(unknown) = AliasedDefinition :
|
||||
@@ -37550,14 +37550,6 @@ try_except.c:
|
||||
# 56| mu56_13(int *) = InitializeParameter[d] : &:r56_12
|
||||
# 56| r56_14(int *) = Load[d] : &:r56_12, ~m?
|
||||
# 56| mu56_15(unknown) = InitializeIndirection[d] : &:r56_14
|
||||
# 56| r56_16(glval<int *>) = VariableAddress[e] :
|
||||
# 56| mu56_17(int *) = InitializeParameter[e] : &:r56_16
|
||||
# 56| r56_18(int *) = Load[e] : &:r56_16, ~m?
|
||||
# 56| mu56_19(unknown) = InitializeIndirection[e] : &:r56_18
|
||||
# 56| r56_20(glval<int *>) = VariableAddress[f] :
|
||||
# 56| mu56_21(int *) = InitializeParameter[f] : &:r56_20
|
||||
# 56| r56_22(int *) = Load[f] : &:r56_20, ~m?
|
||||
# 56| mu56_23(unknown) = InitializeIndirection[f] : &:r56_22
|
||||
# 57| r57_1(glval<int>) = VariableAddress[x] :
|
||||
# 57| r57_2(int) = Constant[0] :
|
||||
# 57| mu57_3(int) = Store[x] : &:r57_1, r57_2
|
||||
@@ -37568,11 +37560,11 @@ try_except.c:
|
||||
#-----| SEH Exception -> Block 8
|
||||
|
||||
# 56| Block 1
|
||||
# 56| v56_24(void) = AliasedUse : ~m?
|
||||
# 56| v56_25(void) = ExitFunction :
|
||||
# 56| v56_16(void) = AliasedUse : ~m?
|
||||
# 56| v56_17(void) = ExitFunction :
|
||||
|
||||
# 56| Block 2
|
||||
# 56| v56_26(void) = Unwind :
|
||||
# 56| v56_18(void) = Unwind :
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 59| Block 3
|
||||
@@ -37630,12 +37622,10 @@ try_except.c:
|
||||
|
||||
# 66| Block 10
|
||||
# 66| v66_1(void) = NoOp :
|
||||
# 56| v56_27(void) = ReturnIndirection[b] : &:r56_6, ~m?
|
||||
# 56| v56_28(void) = ReturnIndirection[c] : &:r56_10, ~m?
|
||||
# 56| v56_29(void) = ReturnIndirection[d] : &:r56_14, ~m?
|
||||
# 56| v56_30(void) = ReturnIndirection[e] : &:r56_18, ~m?
|
||||
# 56| v56_31(void) = ReturnIndirection[f] : &:r56_22, ~m?
|
||||
# 56| v56_32(void) = ReturnVoid :
|
||||
# 56| v56_19(void) = ReturnIndirection[b] : &:r56_6, ~m?
|
||||
# 56| v56_20(void) = ReturnIndirection[c] : &:r56_10, ~m?
|
||||
# 56| v56_21(void) = ReturnIndirection[d] : &:r56_14, ~m?
|
||||
# 56| v56_22(void) = ReturnVoid :
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
try_except.cpp:
|
||||
|
||||
@@ -53,7 +53,7 @@ void j(int b) {
|
||||
}
|
||||
}
|
||||
|
||||
void k(int *b, int *c, int *d, int *e, int *f) {
|
||||
void k(int *b, int *c, int *d) {
|
||||
int x = 0;
|
||||
__try {
|
||||
x = *b;
|
||||
|
||||
Reference in New Issue
Block a user