]> granicus.if.org Git - clang/commitdiff
fix rdar://7683173, rejecting an invalid conditional
authorChris Lattner <sabre@nondot.org>
Fri, 26 Feb 2010 19:42:53 +0000 (19:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 26 Feb 2010 19:42:53 +0000 (19:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97253 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPExpressions.cpp
test/Preprocessor/directive-invalid.c [new file with mode: 0644]

index 2a6b2a7294178ef3d7fbb21b956a80d49914f9b4..3b620d09345a19ffe0b7c5ac5e014f9ec2e12174 100644 (file)
@@ -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 (file)
index 0000000..86cd253
--- /dev/null
@@ -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