aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/PPExpressions.cpp2
-rw-r--r--test/Preprocessor/directive-invalid.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp
index 2a6b2a7294..3b620d0934 100644
--- a/lib/Lex/PPExpressions.cpp
+++ b/lib/Lex/PPExpressions.cpp
@@ -106,7 +106,7 @@ static bool EvaluateDefined(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
// Consume identifier.
Result.setEnd(PeekTok.getLocation());
- PP.LexNonComment(PeekTok);
+ PP.LexUnexpandedToken(PeekTok);
// If we are in parens, ensure we have a trailing ).
if (LParenLoc.isValid()) {
diff --git a/test/Preprocessor/directive-invalid.c b/test/Preprocessor/directive-invalid.c
new file mode 100644
index 0000000000..86cd253bf2
--- /dev/null
+++ b/test/Preprocessor/directive-invalid.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -verify %s
+// rdar://7683173
+
+#define r_paren )
+#if defined( x r_paren // expected-error {{missing ')' after 'defined'}} \
+ // expected-note {{to match this '('}}
+#endif