[PATCH] D78573: [Clang][Sema] Capturing section type conflicts between #pragma clang section and section attributes

Lucas Prates via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 07:29:27 PDT 2020


pratlucas marked 4 inline comments as done.
pratlucas added inline comments.


================
Comment at: clang/include/clang/AST/ASTContext.h:3008
+/// Insertion operator for diagnostics.
+inline const DiagnosticBuilder &
+operator<<(const DiagnosticBuilder &DB,
----------------
rnk wrote:
> It seems like there is no need for this to be defined inline, since it is presumably cold code.
The `inline`'s purpose here is just to allow the definition in the header file, avoiding multiple definition errors.


================
Comment at: clang/test/Sema/pragma-clang-section.c:28
+const int y __attribute__((section("myrodata.5"))) = 10; // expected-note {{declared here}}
+#pragma clang section data = "myrodata.5"                // expected-error {{this causes a section type conflict with 'y'}}
+
----------------
rnk wrote:
> Please add a case like:
>   const int y __attribute__((section("myrodata.6"))) = 11;
> There should be no diagnostics in this case, and I expect myrodata.6 to override the pragma, since it is more specific to the declaration.
I've added this case to the test.
The overriding behaviour is already checked by `clang/test/CodeGen/clang-sections-attribute.c`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78573





More information about the cfe-commits mailing list