[cfe-commits] r130042 - in /cfe/trunk: lib/Parse/ParseExprCXX.cpp test/CodeCompletion/PR9728.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Apr 22 18:04:12 PDT 2011


Author: akirtzidis
Date: Fri Apr 22 20:04:12 2011
New Revision: 130042

URL: http://llvm.org/viewvc/llvm-project?rev=130042&view=rev
Log:
Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.

Added:
    cfe/trunk/test/CodeCompletion/PR9728.cpp
Modified:
    cfe/trunk/lib/Parse/ParseExprCXX.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=130042&r1=130041&r2=130042&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Fri Apr 22 20:04:12 2011
@@ -161,7 +161,12 @@
         // Code completion for a nested-name-specifier, where the code
         // code completion token follows the '::'.
         Actions.CodeCompleteQualifiedId(getCurScope(), SS, EnteringContext);
-        ConsumeCodeCompletionToken();
+        SourceLocation ccLoc = ConsumeCodeCompletionToken();
+        // Include code completion token into the range of the scope otherwise
+        // when we try to annotate the scope tokens the dangling code completion
+        // token will cause assertion in
+        // Preprocessor::AnnotatePreviousCachedTokens.
+        SS.setEndLoc(ccLoc);
       }
     }
 

Added: cfe/trunk/test/CodeCompletion/PR9728.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/PR9728.cpp?rev=130042&view=auto
==============================================================================
--- cfe/trunk/test/CodeCompletion/PR9728.cpp (added)
+++ cfe/trunk/test/CodeCompletion/PR9728.cpp Fri Apr 22 20:04:12 2011
@@ -0,0 +1,9 @@
+namespace N {
+struct SFoo;
+}
+
+struct brokenfile_t {
+  brokenfile_t (N::
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:20 %s -o - | FileCheck %s
+  // CHECK: SFoo
+





More information about the cfe-commits mailing list