[LLVMbugs] [Bug 15244] New: Code completion fails with tricky macro

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 12 02:56:14 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15244

            Bug ID: 15244
           Summary: Code completion fails with tricky macro
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kelvin9302104 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Test program source code:
/* test.c */
#include "test.h"
#include <stdio.h>

int main()
{
    struct test_struct test;
    test.sth2_1 = 123;    /* Here is the problem! */

    printf("%d\n", test.sth2.sth1_in_sth2);
}

/* test.h */
#define sth2_1 sth2.sth1_in_sth2

struct test_struct
{
    int sth1;
    struct
    {
        int sth1_in_sth2;
        int sth2_in_sth2;
    } sth2;
};

When I typed 'test.', clang gives me the following:

COMPLETION: sth1 : [#int#]sth1
COMPLETION: sth2 : [#struct <anonymous>#]sth2

But actually, using test.sth2_1 is also acceptable. The above test problem can
be compiled properly and gives me the expected result (output '123'). What I
*expected* from clang is:

COMPLETION: sth1 : [#int#]sth1
COMPLETION: sth2 : [#struct <anonymous>#]sth2
COMPLETION: sth2_1 : [#int#]sth2.sth1_in_sth2 (or [#int#]sth2_1)

Is there any solution?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130212/bbf886bb/attachment.html>


More information about the llvm-bugs mailing list