Status of "-parse-print-callbacks"

I am wondering, what is the status of using the "-parse-print-callbacks"
flag for clang-cc?

Should it succeed and fail when normal parsing would succeed and fail?

I ask because I see discrepancies:

   # cat test.c
   typedef struct foo { int x; } foo;
   void test() {
     foo *foo;
     foo->x = 0;
   }
   # clang-cc test.c
   # clang-cc -parse-print-callbacks test.c 1>/dev/null
   test.c:4:6: error: expected identifier or '('
     foo->x = 0;
        ^
   test.c:4:6: error: parse error
   2 diagnostics generated.

Is this something that warrants a PR and/or following up on? Or is
"-parse-print-callbacks" something that might not be worth updating
because C++ parsing is still in development?

Just Curious,
-Jon Simons

I am wondering, what is the status of using the "-parse-print-callbacks"
flag for clang-cc?

Should it succeed and fail when normal parsing would succeed and fail?

For C, yes.

I ask because I see discrepancies:

   # cat test.c
   typedef struct foo { int x; } foo;
   void test() {
     foo *foo;
     foo->x = 0;
   }
   # clang-cc test.c
   # clang-cc -parse-print-callbacks test.c 1>/dev/null
   test.c:4:6: error: expected identifier or '('
     foo->x = 0;
        ^
   test.c:4:6: error: parse error
   2 diagnostics generated.

Is this something that warrants a PR and/or following up on? Or is
"-parse-print-callbacks" something that might not be worth updating
because C++ parsing is still in development?

This looks like a bug. C++ parsing shouldn't affect the callback printer
for C. There's little chance the callback printer will ever support C++
(too much work, too little gain), but that's a different story.

Hi Jon,

I have just noticed this as well; I believe this is a recent regression. I’m about to file a bug…

  • Daniel