[PATCH] Implement StmtWithCleanups

Wei Pan wei.pan at intel.com
Mon Apr 15 09:36:03 PDT 2013


  Here is the generated AST before and after for the following example.

  int x;
  asm("" : : "r"(^{ return x; }()));

  `-ExprWithCleanups 0x65bd718 <<invalid sloc>> 'void'
    |-cleanup Block 0x65bd4a0
    `-StmtExpr 0x65bd6f8 <<invalid sloc>> 'void'
      `-CompoundStmt 0x65bd6d8 <<invalid sloc>>
        `-GCCAsmStmt 0x65bd670 <line:19:3, col:35>
          `-CallExpr 0x65bd640 <col:18, col:33> 'int'
            `-BlockExpr 0x65bd628 <col:18, col:31> 'int (^)(void)'
              |-BlockDecl 0x65bd4a0 <col:18, col:31>
              | |-capture ParmVar 0x65bd2a0 'x' 'int'
              | `-CompoundStmt 0x65bd598 <col:19, col:31>
              |   `-ReturnStmt 0x65bd578 <col:21, col:28>
              |     `-ImplicitCastExpr 0x65bd560 <col:28> 'int' <LValueToRValue>
              |       `-DeclRefExpr 0x65bd538 <col:28> 'const int' lvalue ParmVar 0x65bd2a0 'x' 'int'

  `-StmtWithCleanups 0x3c62760 <line:19:3, col:35>
    |-cleanup Block 0x3c62530
    `-GCCAsmStmt 0x3c626f8 <col:3, col:35>
      `-CallExpr 0x3c626d0 <col:18, col:33> 'int'
        `-BlockExpr 0x3c626b8 <col:18, col:31> 'int (^)(void)'
          |-BlockDecl 0x3c62530 <col:18, col:31>
          | |-capture ParmVar 0x3c62330 'x' 'int'
          | `-CompoundStmt 0x3c62628 <col:19, col:31>
          |   `-ReturnStmt 0x3c62608 <col:21, col:28>
          |     `-ImplicitCastExpr 0x3c625f0 <col:28> 'int' <LValueToRValue>
          |       `-DeclRefExpr 0x3c625c8 <col:28> 'const int' lvalue ParmVar 0x3c62330 'x' 'int'

http://llvm-reviews.chandlerc.com/D672



More information about the cfe-commits mailing list