[PATCH] D36487: Emit section information for extern variables.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 05:04:18 PDT 2017


efriedma added a comment.

> Should I restrict the warning to just redeclarations (without definition) instead?

I think just redeclarations.  The pattern of a declaration without a section followed by a definition with a section is common, and not really harmful.



================
Comment at: lib/Sema/SemaDecl.cpp:2613
+  if (New->hasAttr<SectionAttr>() && !Old->hasAttr<SectionAttr>() &&
+      Old->isUsed()) {
+    Diag(New->getLocation(), diag::warn_attribute_section_on_redeclaration);
----------------
Probably don't want to check isUsed(); that's going to seem inconsistent to users.


https://reviews.llvm.org/D36487





More information about the cfe-commits mailing list