[PATCH] D101457: [clang] remove dead code after 2a1332245fc

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 28 07:23:47 PDT 2021


thakis created this revision.
thakis added a reviewer: hans.
Herald added a reviewer: aaron.ballman.
thakis requested review of this revision.

Commit 2a1332245fc extracted this code to a new function checkSectionName() and
added a call to it, but didn't remove the original code. The original code
is dead since the checkSectionName() early return would fire when it would
trigger. (If it weren't dead, it'd make clang crash since
err_attribute_section_invalid_for_target now takes two args instead of just the
one that's passed.)

No behavior change.


https://reviews.llvm.org/D101457

Files:
  clang/lib/Sema/SemaDeclAttr.cpp


Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -3006,13 +3006,6 @@
   if (!S.checkSectionName(LiteralLoc, Str))
     return;
 
-  // If the target wants to validate the section specifier, make it happen.
-  if (llvm::Error E = S.Context.getTargetInfo().isValidSectionSpecifier(Str)) {
-    S.Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target)
-        << toString(std::move(E));
-    return;
-  }
-
   SectionAttr *NewAttr = S.mergeSectionAttr(D, AL, Str);
   if (NewAttr) {
     D->addAttr(NewAttr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101457.341194.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210428/d4df2658/attachment-0001.bin>


More information about the cfe-commits mailing list