summaryrefslogtreecommitdiff
path: root/test/Preprocessor
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-08-01 09:10:37 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-08-01 09:10:37 +0000
commit651f0b87596ebcc37879fd906ebf0ea9a2f13aa8 (patch)
treeeace9c6d4f45f401229969ad0f2c9bca5422346f /test/Preprocessor
parent21fc77356caa9faba15a825499563e337c1f6a5c (diff)
downloadclang-651f0b87596ebcc37879fd906ebf0ea9a2f13aa8.tar.gz
[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
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/stringize_skipped.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Preprocessor/stringize_skipped.c b/test/Preprocessor/stringize_skipped.c
new file mode 100644
index 0000000000..e9395fbbb4
--- /dev/null
+++ b/test/Preprocessor/stringize_skipped.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// Ensure we see the error from PP and do not see errors from the parser.
+
+// expected-error@+1{{'#' is not followed by a macro parameter}}
+#define INVALID() #B 10+10