[PATCH] Implementation of #pragma (data|code|const|bss)_seg
Warren Hunt
whunt at google.com
Mon Apr 7 18:25:36 PDT 2014
Addresses Aaron's comments. Also rebased and incorporates init_seg using the unified MS pragma handling machinery.
Specific comments:
* added documentation for the __declspec(allocate) attribute
* warnings were added and expanded upon, but could not be fused
* XXXXSeg renamed to Segment
* Fixed style issues around &and *
* SectionInfo will be read during codegen (we can make it private and add an interface if we really need to, noone's going to access it for anything they don't need...)
* Added a significant number of parser tests, found a bug and fixed that
* Added a custom diagnostic for shared, nopage, nocache, discard and remove
* Fixed things that would break MSVC2012
* Other random small fixes requested.
Specific Replies:
* We're using eof instead of eod for our pragmas due to the way that certain parser helpers work. Things like parsestringliteral can walk through an eod but not an eof. Richard Smith suggested this.
* After talking to a couple people here about [&] for the lambdas (I'm new to lambdas and am looking for guidance) there was some consensus that these lambdas are both so short and used so locally that being more explicit about what exactly they capture is not particularly more clear and adds code.
* The Add followed by Remove process (rather than making the add conditional based on it not being immediately removed) significantly simplified the implantation logic by allowing Unify to always look at the attribute. Given that this particular piece of code is colder than cold (someone is mis-using an extremely rare and specific pragma) I opted for code size/simplicity over performance.
Hi rsmith, majnemer, rnk, aaron.ballman,
http://reviews.llvm.org/D3065
CHANGE SINCE LAST DIFF
http://reviews.llvm.org/D3065?vs=8320&id=8416#toc
Files:
include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/TokenKinds.def
include/clang/Parse/Parser.h
include/clang/Sema/Sema.h
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParsePragma.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/Parser.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaAttr.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaObjCProperty.cpp
test/CodeGen/function-sections.c
test/CodeGen/sections.c
test/Sema/pragma-section.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3065.4.patch
Type: text/x-patch
Size: 37460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140407/c60480e6/attachment.bin>
More information about the cfe-commits
mailing list