[LLVMbugs] [Bug 14316] New: [patch] pretty print for anonymous structure dereference is buggy

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 11 03:07:42 PST 2012


             Bug #: 14316
           Summary: [patch] pretty print for anonymous structure
                    dereference is buggy
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: florent.bruneau_llvm at m4x.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9524
  --> http://llvm.org/bugs/attachment.cgi?id=9524
Patch for the issue

When I have an expression of the form

 struct blah {
   struct {
     struct {
       int b;

 int foo(const struct blah *b) {
   return b->b;

The expression 'b->b' has the following (correct) AST:
 (ImplicitCastExpr 0x44bc968 'int' <LValueToRValue>
   (MemberExpr 0x44bc8f0 'int' lvalue .b 0x44899b0
     (MemberExpr 0x44bc8c0 'struct blah::<anonymous at blah.blk:3:9>' lvalue .
       (MemberExpr 0x44bc890 'struct blah::<anonymous at blah.blk:2:5>' lvalue
-> 0x44bc2f0
         (ImplicitCastExpr 0x44bc878 'union blah *' <LValueToRValue>
           (DeclRefExpr 0x44bc850 'union blah *' lvalue ParmVar 0x44bc440 'b'
'union blah *'))))))

Put the pretty printer badly print this as 'b.b' because all the MemberExpr
targeting anonymous types are simply ignored. The patch fix that behavior: the
arrow/dot notation is printed if the base of the expression is not anonymous.

The patch is based on the 3.1 release branch of the git mirror.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list