[PATCH] D93102: [Clang][Sema] Detect section type conflicts between functions and variables

Tomas Matheson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 09:36:31 PST 2020


tmatheson marked 3 inline comments as done.
tmatheson added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:3048
     D->addAttr(NewAttr);
+    if (auto FD = dyn_cast<FunctionDecl>(D))
+      if (auto SA = dyn_cast<SectionAttr>(NewAttr))
----------------
aaron.ballman wrote:
> Does this need to be limited to function declarations? It seems to me that this should also be used on say ObjCMethod declarations or global variables as well, right?
> 
> If so, then `Sema::UnifySection()` may need to be updated as well as it currently accepts a `DeclaratorDecl` but some of these constructs (like `ObjcMethodDecl` and `ObjCPropertyDecl`) are `NamedDecl`s and not declarators.
I've extended this to include Objective-C methods and properties and template functions. Gobal variables are handled by Sema::CheckCompleteVariableDeclaration.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93102



More information about the cfe-commits mailing list