[PATCH] D24484: [analyzer] Fix ExprEngine::VisitMemberExpr

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 17:30:42 PDT 2016


alexshap added a comment.

1.

For the code:

  struct TestBufferStruct {
    int Buffer[3];
  };
  
  struct TestBufferStruct GetTestBufferStruct() {
    struct TestBufferStruct a;
    return a;
  }
  
  void AcceptPointer(int *a) {
  }
  
  void TestFunc() {
     AcceptArray(((GetTestBufferStruct().Buffer)));
  }

AST looks like this:

  `-ImplicitCastExpr 0x103879640 <col:15, col:46> 'int *' <ArrayToPointerDecay>
     `-ParenExpr 0x1038795b0 <col:15, col:46> 'int [3]'
       `-ParenExpr 0x103879590 <col:16, col:45> 'int [3]'
         `-MemberExpr 0x103879558 <col:17, col:39> 'int [3]' .Buffer 0x103833598
           `-CallExpr 0x103879530 <col:17, col:37> 'struct TestBufferStruct':'struct TestBufferStruct'
             `-ImplicitCastExpr 0x103879518 <col:17> 'struct TestBufferStruct (*)()' <FunctionToPointerDecay>
               `-DeclRefExpr 0x103879498 <col:17> 'struct TestBufferStruct ()' Function 0x103878eb8 'GetTestBufferStruct' 'struct 

1.

Test plan: make -j8 check-clang-analysis.
Without my changes it crashes (on the modified test):
F2423801: Screen Shot 2016-09-12 at 5.09.47 PM.png <https://reviews.llvm.org/F2423801>
With the patch all the tests are green.


Repository:
  rL LLVM

https://reviews.llvm.org/D24484





More information about the cfe-commits mailing list