[PATCH] D130363: [clang] Give priority to Class context while parsing declarations

Furkan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 07:47:21 PDT 2022


furkanusta created this revision.
Herald added subscribers: usaxena95, kadircet.
Herald added a project: All.
furkanusta requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added a project: clang.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130363

Files:
  clang/lib/Parse/ParseDecl.cpp


Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3266,13 +3266,13 @@
         return;
       }
 
-      if (getCurScope()->getFnParent() || getCurScope()->getBlockParent())
-        CCC = Sema::PCC_LocalDeclarationSpecifiers;
-      else if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
+      if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
         CCC = DSContext == DeclSpecContext::DSC_class ? Sema::PCC_MemberTemplate
                                                       : Sema::PCC_Template;
       else if (DSContext == DeclSpecContext::DSC_class)
         CCC = Sema::PCC_Class;
+      else if (getCurScope()->getFnParent() || getCurScope()->getBlockParent())
+        CCC = Sema::PCC_LocalDeclarationSpecifiers;
       else if (CurParsedObjCImpl)
         CCC = Sema::PCC_ObjCImplementation;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130363.446833.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220722/fd53864e/attachment.bin>


More information about the cfe-commits mailing list