]> granicus.if.org Git - clang/commit
[Preprocessor] Always discard body of #define if we failed to parse it
authorIlya Biryukov <ibiryukov@google.com>
Thu, 1 Aug 2019 09:10:37 +0000 (09:10 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Thu, 1 Aug 2019 09:10:37 +0000 (09:10 +0000)
commit651f0b87596ebcc37879fd906ebf0ea9a2f13aa8
treeeace9c6d4f45f401229969ad0f2c9bca5422346f
parent21fc77356caa9faba15a825499563e337c1f6a5c
[Preprocessor] Always discard body of #define if we failed to parse it

Summary:
Preivously we would only discard it if we failed to parse parameter lists.
If we do not consume the body, parser sees tokens inside directive. In
turn, this leads to spurious diagnostics and a crash in TokenBuffer, see
the added tests.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65517

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367530 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Lex/PPDirectives.cpp
test/Preprocessor/stringize_skipped.c [new file with mode: 0644]
unittests/Tooling/Syntax/TokensTest.cpp