[PATCH] D134243: Don't crash when code completing `using enum ^Foo`.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 16:40:46 PDT 2022


sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added a subscriber: kadircet.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fixes https://github.com/clangd/clangd/issues/1281


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134243

Files:
  clang/lib/Parse/ParseDecl.cpp
  clang/test/CodeCompletion/using-enum.cpp


Index: clang/test/CodeCompletion/using-enum.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeCompletion/using-enum.cpp
@@ -0,0 +1,7 @@
+enum class AAA { X, Y, Z };
+
+namespace N2 {
+  using enum AAA;
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: COMPLETION: AAA
+};
Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -4588,6 +4588,7 @@
     // Code completion for an enum name.
     cutOffParsing();
     Actions.CodeCompleteTag(getCurScope(), DeclSpec::TST_enum);
+    DS.SetTypeSpecError();
     return;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134243.461416.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220919/e646d6ff/attachment.bin>


More information about the cfe-commits mailing list