[cfe-commits] r121431 - in /cfe/trunk: lib/Lex/PPDirectives.cpp test/CodeCompletion/ordinary-name.c

Douglas Gregor dgregor at apple.com
Thu Dec 9 15:35:36 PST 2010


Author: dgregor
Date: Thu Dec  9 17:35:36 2010
New Revision: 121431

URL: http://llvm.org/viewvc/llvm-project?rev=121431&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Lex/PPDirectives.cpp
    cfe/trunk/test/CodeCompletion/ordinary-name.c

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=121431&r1=121430&r2=121431&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Thu Dec  9 17:35:36 2010
@@ -1046,6 +1046,12 @@
   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())

Modified: cfe/trunk/test/CodeCompletion/ordinary-name.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/ordinary-name.c?rev=121431&r1=121430&r2=121431&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/ordinary-name.c (original)
+++ cfe/trunk/test/CodeCompletion/ordinary-name.c Thu Dec  9 17:35:36 2010
@@ -12,3 +12,6 @@
   // 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





More information about the cfe-commits mailing list