From: Douglas Gregor Date: Thu, 9 Dec 2010 23:35:36 +0000 (+0000) Subject: Don't crash when code-completing after "#include <". It would be far X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25bb03bc0f2561e830d866d5905b20c5475d6762;p=clang Don't crash when code-completing after "#include <". It would be far better to actually produce a decent set of completions by checking the system include paths, but not today. Fixes PR8744. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121431 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index ee8883b8b2..3414c27bfc 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1046,6 +1046,12 @@ bool Preprocessor::ConcatenateIncludeName( while (CurTok.isNot(tok::eom)) { End = CurTok.getLocation(); + // FIXME: Provide code completion for #includes. + if (CurTok.is(tok::code_completion)) { + Lex(CurTok); + continue; + } + // Append the spelling of this token to the buffer. If there was a space // before it, add it now. if (CurTok.hasLeadingSpace()) diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c index 0807b74b12..dda7bb018a 100644 --- a/test/CodeCompletion/ordinary-name.c +++ b/test/CodeCompletion/ordinary-name.c @@ -12,3 +12,6 @@ void foo() { // CHECK-CC1: foo // CHECK-CC1: TYPEDEF // CHECK-CC1: y + + // PR8744 + // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:1:11 %s