mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: respond to PR comments
This commit is contained in:
@@ -1475,7 +1475,7 @@ class BufferMayWriteSideEffectInstruction extends SideEffectInstruction {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* An instruction representing a GNU or MSVC inline assembly statement.
|
||||
*/
|
||||
class InlineAsmInstruction extends Instruction {
|
||||
InlineAsmInstruction() {
|
||||
|
||||
@@ -1475,7 +1475,7 @@ class BufferMayWriteSideEffectInstruction extends SideEffectInstruction {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* An instruction representing a GNU or MSVC inline assembly statement.
|
||||
*/
|
||||
class InlineAsmInstruction extends Instruction {
|
||||
InlineAsmInstruction() {
|
||||
|
||||
@@ -64,6 +64,8 @@ private predicate ignoreExprAndDescendants(Expr expr) {
|
||||
// represent them.
|
||||
newExpr.getInitializer().getFullyConverted() = expr
|
||||
) or
|
||||
// Ignore descendants of asm statements, since we can't differentiate inputs and outputs
|
||||
getRealParent(expr) instanceof AsmStmt or
|
||||
ignoreExprAndDescendants(getRealParent(expr)) // recursive case
|
||||
}
|
||||
|
||||
|
||||
@@ -1475,7 +1475,7 @@ class BufferMayWriteSideEffectInstruction extends SideEffectInstruction {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* An instruction representing a GNU or MSVC inline assembly statement.
|
||||
*/
|
||||
class InlineAsmInstruction extends Instruction {
|
||||
InlineAsmInstruction() {
|
||||
|
||||
@@ -7580,3 +7580,40 @@ ir.cpp:
|
||||
# 1101| 0: x
|
||||
# 1101| Type = int
|
||||
# 1101| ValueCategory = prvalue(load)
|
||||
# 1104| void AsmStmtWithOutputs(unsigned int&, unsigned int&, unsigned int&, unsigned int&)
|
||||
# 1104| params:
|
||||
# 1104| 0: a
|
||||
# 1104| Type = unsigned int &
|
||||
# 1104| 1: b
|
||||
# 1104| Type = unsigned int &
|
||||
# 1104| 2: c
|
||||
# 1104| Type = unsigned int &
|
||||
# 1104| 3: d
|
||||
# 1104| Type = unsigned int &
|
||||
# 1105| body: { ... }
|
||||
# 1107| 0: asm statement
|
||||
# 1110| 0: (reference dereference)
|
||||
# 1110| Type = unsigned int
|
||||
# 1110| ValueCategory = lvalue
|
||||
# 1110| expr: a
|
||||
# 1110| Type = unsigned int &
|
||||
# 1110| ValueCategory = prvalue(load)
|
||||
# 1110| 1: (reference dereference)
|
||||
# 1110| Type = unsigned int
|
||||
# 1110| ValueCategory = lvalue
|
||||
# 1110| expr: b
|
||||
# 1110| Type = unsigned int &
|
||||
# 1110| ValueCategory = prvalue(load)
|
||||
# 1110| 2: (reference dereference)
|
||||
# 1110| Type = unsigned int
|
||||
# 1110| ValueCategory = lvalue
|
||||
# 1110| expr: c
|
||||
# 1110| Type = unsigned int &
|
||||
# 1110| ValueCategory = prvalue(load)
|
||||
# 1110| 3: (reference dereference)
|
||||
# 1110| Type = unsigned int
|
||||
# 1110| ValueCategory = lvalue
|
||||
# 1110| expr: d
|
||||
# 1110| Type = unsigned int &
|
||||
# 1110| ValueCategory = prvalue(load)
|
||||
# 1118| 1: return ...
|
||||
|
||||
@@ -1101,4 +1101,20 @@ int AsmStmt(int x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static void AsmStmtWithOutputs(unsigned int& a, unsigned int& b, unsigned int& c, unsigned int& d)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"cpuid\n\t"
|
||||
: "+a" (a), "+b" (b), "+c" (c), "+d" (d)
|
||||
);
|
||||
#else
|
||||
a++;
|
||||
b++;
|
||||
c++;
|
||||
d++;
|
||||
#endif
|
||||
}
|
||||
|
||||
// semmle-extractor-options: -std=c++17
|
||||
|
||||
@@ -5015,3 +5015,22 @@ ir.cpp:
|
||||
# 1099| v0_11(void) = ReturnValue : &:r0_10, ~mu0_2
|
||||
# 1099| v0_12(void) = UnmodeledUse : mu*
|
||||
# 1099| v0_13(void) = ExitFunction :
|
||||
|
||||
# 1104| void AsmStmtWithOutputs(unsigned int&, unsigned int&, unsigned int&, unsigned int&)
|
||||
# 1104| Block 0
|
||||
# 1104| v0_0(void) = EnterFunction :
|
||||
# 1104| mu0_1(unknown) = AliasedDefinition :
|
||||
# 1104| mu0_2(unknown) = UnmodeledDefinition :
|
||||
# 1104| r0_3(glval<unsigned int &>) = VariableAddress[a] :
|
||||
# 1104| mu0_4(unsigned int &) = InitializeParameter[a] : &:r0_3
|
||||
# 1104| r0_5(glval<unsigned int &>) = VariableAddress[b] :
|
||||
# 1104| mu0_6(unsigned int &) = InitializeParameter[b] : &:r0_5
|
||||
# 1104| r0_7(glval<unsigned int &>) = VariableAddress[c] :
|
||||
# 1104| mu0_8(unsigned int &) = InitializeParameter[c] : &:r0_7
|
||||
# 1104| r0_9(glval<unsigned int &>) = VariableAddress[d] :
|
||||
# 1104| mu0_10(unsigned int &) = InitializeParameter[d] : &:r0_9
|
||||
# 1107| mu0_11(unknown) = InlineAsm : ~mu0_2
|
||||
# 1118| v0_12(void) = NoOp :
|
||||
# 1104| v0_13(void) = ReturnVoid :
|
||||
# 1104| v0_14(void) = UnmodeledUse : mu*
|
||||
# 1104| v0_15(void) = ExitFunction :
|
||||
|
||||
Reference in New Issue
Block a user