[cfe-commits] r61666 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Parse/ParseExprCXX.cpp test/SemaCXX/qualified-id-lookup.cpp

Chris Lattner sabre at nondot.org
Sun Jan 4 17:42:04 PST 2009


Author: lattner
Date: Sun Jan  4 19:42:04 2009
New Revision: 61666

URL: http://llvm.org/viewvc/llvm-project?rev=61666&view=rev
Log:
Fix a bug where we'd try to look beyond the current cached tokens when
not in backtracking mode.  This was just using the wrong predicate.

Modified:
    cfe/trunk/include/clang/Lex/Preprocessor.h
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/test/SemaCXX/qualified-id-lookup.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=61666&r1=61665&r2=61666&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Sun Jan  4 19:42:04 2009
@@ -414,7 +414,7 @@
   /// invoked.
   void AnnotateCachedTokens(const Token &Tok) {
     assert(Tok.isAnnotationToken() && "Expected annotation token");
-    if (CachedLexPos != 0 && InCachingLexMode())
+    if (CachedLexPos != 0 && isBacktrackEnabled())
       AnnotatePreviousCachedTokens(Tok);
   }
   

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=61666&r1=61665&r2=61666&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Jan  4 19:42:04 2009
@@ -68,8 +68,8 @@
       SourceLocation CCLoc = ConsumeToken();
       
       // ::new and ::delete aren't nested-name-specifiers, and 
-      // MaybeParseCXXScopeSpecifier is never called in a context where one could
-      // exist.  This means that if we see it, we have a syntax error.
+      // MaybeParseCXXScopeSpecifier is never called in a context where one
+      // could exist.  This means that if we see it, we have a syntax error.
       if (Tok.is(tok::kw_new) || Tok.is(tok::kw_delete)) {
         Diag(Tok, diag::err_invalid_qualified_new_delete)
           << Tok.is(tok::kw_delete);

Modified: cfe/trunk/test/SemaCXX/qualified-id-lookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/qualified-id-lookup.cpp?rev=61666&r1=61665&r2=61666&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/qualified-id-lookup.cpp (original)
+++ cfe/trunk/test/SemaCXX/qualified-id-lookup.cpp Sun Jan  4 19:42:04 2009
@@ -53,3 +53,14 @@
   int v3 = ::i1;
 }
 
+typedef int f2_type;
+namespace a {
+  typedef int f2_type(int, int);
+
+  void test_f2() {
+    ::f2_type(1, 2); // expected-error {{function-style cast to a builtin type can only take one argument}}
+  }
+}
+
+
+





More information about the cfe-commits mailing list