[llvm-branch-commits] [cfe-branch] r110971 - in /cfe/branches/Apple/whitney-IB/src/tools/clang: ./ lib/Lex/Lexer.cpp lib/Lex/PPDirectives.cpp lib/Lex/PTHLexer.cpp test/Index/complete-unterminated.c

Daniel Dunbar daniel at zuster.org
Thu Aug 12 15:47:21 PDT 2010


Author: ddunbar
Date: Thu Aug 12 17:47:21 2010
New Revision: 110971

URL: http://llvm.org/viewvc/llvm-project?rev=110971&view=rev
Log:
--- Merging r110933 into 'src/tools/clang':
A    src/tools/clang/test/Index/complete-unterminated.c
U    src/tools/clang/lib/Lex/PPDirectives.cpp
U    src/tools/clang/lib/Lex/Lexer.cpp
U    src/tools/clang/lib/Lex/PTHLexer.cpp


Added:
    cfe/branches/Apple/whitney-IB/src/tools/clang/test/Index/complete-unterminated.c
      - copied unchanged from r110933, cfe/trunk/test/Index/complete-unterminated.c
Modified:
    cfe/branches/Apple/whitney-IB/src/tools/clang/   (props changed)
    cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/Lexer.cpp
    cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PPDirectives.cpp
    cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PTHLexer.cpp

Propchange: cfe/branches/Apple/whitney-IB/src/tools/clang/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 12 17:47:21 2010
@@ -1 +1 @@
-/cfe/trunk:110882,110901,110906,110950
+/cfe/trunk:110882,110901,110906,110933,110950

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/Lexer.cpp?rev=110971&r1=110970&r2=110971&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/Lexer.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/Lexer.cpp Thu Aug 12 17:47:21 2010
@@ -962,7 +962,8 @@
     
     if (C == '\n' || C == '\r' ||             // Newline.
         (C == 0 && CurPtr-1 == BufferEnd)) {  // End of file.
-      if (!isLexingRawMode() && !Features.AsmPreprocessor)
+      if (!isLexingRawMode() && !Features.AsmPreprocessor &&
+          !PP->isCodeCompletionFile(FileLoc))
         Diag(BufferPtr, diag::err_unterminated_string);
       FormTokenWithChars(Result, CurPtr-1, tok::unknown);
       return;
@@ -1039,7 +1040,8 @@
       C = getAndAdvanceChar(CurPtr, Result);
     } else if (C == '\n' || C == '\r' ||             // Newline.
                (C == 0 && CurPtr-1 == BufferEnd)) {  // End of file.
-      if (!isLexingRawMode() && !Features.AsmPreprocessor)
+      if (!isLexingRawMode() && !Features.AsmPreprocessor &&
+          !PP->isCodeCompletionFile(FileLoc))
         Diag(BufferPtr, diag::err_unterminated_char);
       FormTokenWithChars(Result, CurPtr-1, tok::unknown);
       return;
@@ -1564,8 +1566,9 @@
   
   // If we are in a #if directive, emit an error.
   while (!ConditionalStack.empty()) {
-    PP->Diag(ConditionalStack.back().IfLoc,
-             diag::err_pp_unterminated_conditional);
+    if (!PP->isCodeCompletionFile(FileLoc))
+      PP->Diag(ConditionalStack.back().IfLoc,
+               diag::err_pp_unterminated_conditional);
     ConditionalStack.pop_back();
   }
 

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PPDirectives.cpp?rev=110971&r1=110970&r2=110971&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PPDirectives.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PPDirectives.cpp Thu Aug 12 17:47:21 2010
@@ -171,8 +171,9 @@
       // Emit errors for each unterminated conditional on the stack, including
       // the current one.
       while (!CurPPLexer->ConditionalStack.empty()) {
-        Diag(CurPPLexer->ConditionalStack.back().IfLoc,
-             diag::err_pp_unterminated_conditional);
+        if (!isCodeCompletionFile(Tok.getLocation()))
+          Diag(CurPPLexer->ConditionalStack.back().IfLoc,
+               diag::err_pp_unterminated_conditional);
         CurPPLexer->ConditionalStack.pop_back();
       }
 

Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PTHLexer.cpp?rev=110971&r1=110970&r2=110971&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PTHLexer.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Lex/PTHLexer.cpp Thu Aug 12 17:47:21 2010
@@ -146,8 +146,9 @@
 
   // If we are in a #if directive, emit an error.
   while (!ConditionalStack.empty()) {
-    PP->Diag(ConditionalStack.back().IfLoc,
-             diag::err_pp_unterminated_conditional);
+    if (!PP->isCodeCompletionFile(FileStartLoc))
+      PP->Diag(ConditionalStack.back().IfLoc,
+               diag::err_pp_unterminated_conditional);
     ConditionalStack.pop_back();
   }
 





More information about the llvm-branch-commits mailing list