summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-04-11 00:58:58 +0000
committerJordan Rose <jordan_rose@apple.com>2013-04-11 00:58:58 +0000
commitb1312a549567db37da26c19b53439b6b05b1e0e5 (patch)
tree578aea6b8eb7db7798caaa0c8cac96d6b9fb9515 /clang/tools/c-index-test/c-index-test.c
parent9448e8594f3b2b5316d1253785dae0956f508cce (diff)
downloadbcm5719-llvm-b1312a549567db37da26c19b53439b6b05b1e0e5.tar.gz
bcm5719-llvm-b1312a549567db37da26c19b53439b6b05b1e0e5.zip
Force a load when creating a reference to a temporary copied from a bitfield.
For this source: const int &ref = someStruct.bitfield; We used to generate this AST: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'const int' lvalue <NoOp> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Notice the lvalue inside the MaterializeTemporaryExpr, which is very confusing (and caused an assertion to fire in the analyzer - PR15694). We now generate this: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'int' <LValueToRValue> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Which makes a lot more sense. This allows us to remove code in both CodeGen and AST that hacked around this special case. The commit also makes Clang accept this (legal) C++11 code: int &&ref = std::move(someStruct).bitfield PR15694 / <rdar://problem/13600396> llvm-svn: 179250
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud