Home

[MS-ABI] Add support for #pragma section and related pragmas

Press ? to show keyboard shortcuts.
Committed
whuntApr 8 2014, 3:30 PM
Parents
rL205809: Thread Safety Analysis. Misc fixes to SExpr code, responding to code review
Branches
Unknown
Tags
Unknown
Subscribers
None
Projects
None
Description

[MS-ABI] Add support for #pragma section and related pragmas
This patch adds support for the msvc pragmas section, bss_seg, code_seg,
const_seg and data_seg as well as support for __declspec(allocate()).

Additionally it corrects semantics and adds diagnostics for
attribute((section())) and the interaction between the attribute
and the msvc pragmas and declspec. In general conflicts should now be
well diganosed within and among these features.

In supporting the pragmas new machinery for uniform lexing for
msvc pragmas was introduced. The new machinery always lexes the
entire pragma and stores it on an annotation token. The parser
is responsible for parsing the pragma when the handling the
annotation token.

There is a known outstanding bug in this implementation in C mode.
Because these attributes and pragmas apply _only_ to definitions, we
process them at the time we detect a definition. Due to tentative
definitions in C, we end up processing the definition late. This means
that in C mode, everything that ends up in a BSS section will end up in
the _last_ BSS section rather than the one that was live at the time of
tentative definition, even if that turns out to be the point of actual
definition. This issue is not known to impact anything as of yet
because we are not aware of a clear use or use case for #pragma bss_seg
but should be fixed at some point.

Differential Revision=http://reviews.llvm.org/D3065#inline-16241

rL205810

cfe/trunk/include/clang/Basic/Attr.td

Loading...

cfe/trunk/include/clang/Basic/AttrDocs.td

Loading...

cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td

Loading...

cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Loading...

cfe/trunk/include/clang/Basic/TokenKinds.def

Loading...

cfe/trunk/include/clang/Parse/Parser.h

Loading...

cfe/trunk/include/clang/Sema/Sema.h

Loading...

cfe/trunk/lib/Parse/ParseDeclCXX.cpp

Loading...

cfe/trunk/lib/Parse/ParsePragma.cpp

Loading...

cfe/trunk/lib/Parse/ParseStmt.cpp

Loading...

cfe/trunk/lib/Parse/Parser.cpp

Loading...

cfe/trunk/lib/Sema/Sema.cpp

Loading...

cfe/trunk/lib/Sema/SemaAttr.cpp

Loading...

cfe/trunk/lib/Sema/SemaDecl.cpp

Loading...

cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Loading...

cfe/trunk/test/CodeGen/function-sections.c

Loading...

cfe/trunk/test/CodeGen/sections.c

Loading...

cfe/trunk/test/Sema/pragma-section.c

Loading...

Add Comment