C++ IR: Improve ErrorExpr test

The previous version of the test used `0 = 1;` to test an lvalue-typed
`ErrorExpr`, but the extractor replaced the whole assignment expression
with `ErrorExpr` instead of just the LHS. This variation of the test
only leads to an `ErrorExpr` for the part of the syntax that's supposed
to be an lvalue-typed expression, so that's an improvement.
Unfortunately it still doesn't demonstrate that we can `Store` into an
address computed by an `ErrorExpr`.
This commit is contained in:
Jonas Jensen
2019-07-09 13:35:20 +02:00
parent 4324c97d39
commit 0889d5d27a
3 changed files with 25 additions and 21 deletions

View File

@@ -193,10 +193,13 @@ bad_asts.cpp:
# 30| void Bad::errorExpr()
# 30| params:
# 30| body: { ... }
# 31| 0: ExprStmt
#-----| 0: <error expr>
#-----| Type = error
#-----| ValueCategory = prvalue(load)
# 31| 0: declaration
# 31| 0: definition of intref
# 31| Type = int &
# 31| init: initializer for intref
# 31| expr: <error expr>
# 31| Type = error
# 31| ValueCategory = prvalue
# 32| 1: declaration
# 32| 0: definition of x
# 32| Type = int

View File

@@ -28,7 +28,7 @@ namespace Bad {
}
void errorExpr() {
0 = 1;
int &intref = 0;
int x = 0[0];
x = 1[1];
}

View File

@@ -50,22 +50,23 @@ bad_asts.cpp:
# 30| void Bad::errorExpr()
# 30| Block 0
# 30| v0_0(void) = EnterFunction :
# 30| mu0_1(unknown) = AliasedDefinition :
# 30| mu0_2(unknown) = UnmodeledDefinition :
#-----| r0_3(glval<error>) = Error :
#-----| r0_4(error) = Load : &:r0_3, ~mu0_2
# 32| r0_5(glval<int>) = VariableAddress[x] :
# 32| r0_6(error) = Error :
# 32| mu0_7(int) = Store : &:r0_5, r0_6
#-----| r0_8(glval<error>) = Error :
#-----| r0_9(error) = Load : &:r0_8, ~mu0_2
# 33| r0_10(glval<int>) = VariableAddress[x] :
# 33| mu0_11(int) = Store : &:r0_10, r0_9
# 34| v0_12(void) = NoOp :
# 30| v0_13(void) = ReturnVoid :
# 30| v0_14(void) = UnmodeledUse : mu*
# 30| v0_15(void) = ExitFunction :
# 30| v0_0(void) = EnterFunction :
# 30| mu0_1(unknown) = AliasedDefinition :
# 30| mu0_2(unknown) = UnmodeledDefinition :
# 31| r0_3(glval<int &>) = VariableAddress[intref] :
# 31| r0_4(error) = Error :
# 31| mu0_5(int &) = Store : &:r0_3, r0_4
# 32| r0_6(glval<int>) = VariableAddress[x] :
# 32| r0_7(error) = Error :
# 32| mu0_8(int) = Store : &:r0_6, r0_7
#-----| r0_9(glval<error>) = Error :
#-----| r0_10(error) = Load : &:r0_9, ~mu0_2
# 33| r0_11(glval<int>) = VariableAddress[x] :
# 33| mu0_12(int) = Store : &:r0_11, r0_10
# 34| v0_13(void) = NoOp :
# 30| v0_14(void) = ReturnVoid :
# 30| v0_15(void) = UnmodeledUse : mu*
# 30| v0_16(void) = ExitFunction :
clang.cpp:
# 5| int* globalIntAddress()