[PATCH] D48841: Add support for __declspec(code_seg("segname"))

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 12 11:13:33 PST 2023


MaskRay added inline comments.
Herald added a project: All.


================
Comment at: cfe/trunk/lib/Sema/SemaDecl.cpp:2679
+  if (NewCSA && !Old->hasAttr<CodeSegAttr>() &&
+      !NewCSA->isImplicit() && isa<CXXMethodDecl>(New)) {
+    Diag(New->getLocation(), diag::warn_mismatched_section)
----------------
If `!NewCSA->isImplicit() && ` is removed, no `check-clang` test will break.

(This is noticed while I am investigating whether VisibilityAttr can use `isImplicit` as well https://reviews.llvm.org/D153835)


================
Comment at: cfe/trunk/lib/Sema/SemaDeclAttr.cpp:2921
+  if (const auto *ExistingAttr = D->getAttr<CodeSegAttr>()) {
+    if (!ExistingAttr->isImplicit()) {
+      S.Diag(AL.getLoc(),
----------------
If the condition is made unconditional, `if (1) {`, no `check-clang` test will fail.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D48841



More information about the llvm-commits mailing list