]> granicus.if.org Git - clang/commitdiff
Don't crash when code-completing after "#include <". It would be far
authorDouglas Gregor <dgregor@apple.com>
Thu, 9 Dec 2010 23:35:36 +0000 (23:35 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 9 Dec 2010 23:35:36 +0000 (23:35 +0000)
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

lib/Lex/PPDirectives.cpp
test/CodeCompletion/ordinary-name.c

index ee8883b8b26c4ac7e59d6823d903d8a9746c8571..3414c27bfc8b45f1e1fc7f8c91d1cdd611add858 100644 (file)
@@ -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())
index 0807b74b12c4233c1f648c34f655004c763357ba..dda7bb018a0f9f702f8c5cfd490be62216db4353 100644 (file)
@@ -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