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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 25 19:52:42 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Closed by commit rG30b676ac5f30: Don't crash when code completing `using enum ^Foo`. (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D134243?vs=461416&id=462794#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134243/new/

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
@@ -4593,6 +4593,7 @@
     // Code completion for an enum name.
     cutOffParsing();
     Actions.CodeCompleteTag(getCurScope(), DeclSpec::TST_enum);
+    DS.SetTypeSpecError(); // Needed by ActOnUsingDeclaration.
     return;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134243.462794.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220926/3a72faa1/attachment.bin>


More information about the cfe-commits mailing list