diff options
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 7 | ||||
-rw-r--r-- | test/CodeCompletion/PR9728.cpp | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 49d3074119..ccc75125ad 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -161,7 +161,12 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, // 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); } } diff --git a/test/CodeCompletion/PR9728.cpp b/test/CodeCompletion/PR9728.cpp new file mode 100644 index 0000000000..91f49be91f --- /dev/null +++ b/test/CodeCompletion/PR9728.cpp @@ -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 + |