summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/feature_tests.c
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-15 09:03:58 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-15 09:03:58 +0000
commitd616362fe3dc7074945fd476ba8c43fa82524f87 (patch)
tree04bf19d9d90684a793c904c010eaf5c9fc310ff5 /clang/test/Preprocessor/feature_tests.c
parent418ad3ff107dfde7f6d7c3e87f810fbbb8515ed4 (diff)
downloadbcm5719-llvm-d616362fe3dc7074945fd476ba8c43fa82524f87.tar.gz
bcm5719-llvm-d616362fe3dc7074945fd476ba8c43fa82524f87.zip
Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacro
We would CreateString on arbitrary garbage instead of just skipping to the end of the builtin macro. Eventually, this would cause us to crash because we would end up replacing the contents of a character token with a numeric literal. This fixes PR21825. llvm-svn: 224238
Diffstat (limited to 'clang/test/Preprocessor/feature_tests.c')
-rw-r--r--clang/test/Preprocessor/feature_tests.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/test/Preprocessor/feature_tests.c b/clang/test/Preprocessor/feature_tests.c
index 5a2c300e6ee..fbde6a65476 100644
--- a/clang/test/Preprocessor/feature_tests.c
+++ b/clang/test/Preprocessor/feature_tests.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -verify -DVERIFY
// RUN: %clang_cc1 %s -E -triple=i686-apple-darwin9
#ifndef __has_feature
#error Should have __has_feature
@@ -53,3 +53,10 @@
#if !HAS_BUILTIN(MY_ALIAS_BUILTIN) || !HAS_FEATURE(MY_ALIAS_FEATURE)
#error Expansion should have occurred
#endif
+
+#ifdef VERIFY
+// expected-error@+2 {{builtin feature check macro requires a parenthesized identifier}}
+// expected-error@+1 {{expected value in expression}}
+#if __has_feature('x')
+#endif
+#endif
OpenPOWER on IntegriCloud