https://bugs.llvm.org/show_bug.cgi?id=49017

            Bug ID: 49017
           Summary: preprocessor fails to resolve directives in
                    keepComments mode
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: jqua...@web.de
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

When running clang preprocessor with -C option (keep comments), preprocessor
directives that come after a comment are not resolved.

Example:

/* xxx */ #define X 1
int z=X;

clang -E -C keeps the entire code as it is, while clang -E correctly produces:
int z=1;

I would expect the following result:
/* xxx */
int z=1;

As far as I could debug this issue, it seems that pp. directives are only
recognized when the # is the first token on a line. Comments are not considered
for this (first token) criterion - a comment is a token in -C mode - but should
be ignored.

The same behavior occurs in clang 10 and 11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to