diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-07-22 00:53:05 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-07-22 00:53:05 +0000 |
commit | e6de71dffb8ce404e22505f0e80015137437fde9 (patch) | |
tree | dca670a4c974afefaebbf2eb76e9f77e312ebbbd /lib/Sema/SemaAttr.cpp | |
parent | 8a16cb111295cbb321a40788d8ea83e9c240d803 (diff) |
-fms-extensions: Implement half of #pragma init_seg
Summary:
This pragma is very rare. We could *hypothetically* lower some uses of
it down to @llvm.global_ctors, but given that GlobalOpt isn't able to
optimize prioritized global ctors today, there's really no point.
If we wanted to do this in the future, I would check if the section used
in the pragma started with ".CRT$XC" and had up to two characters after
it. Those two characters could form the 16-bit initialization priority
that we support in @llvm.global_ctors. We would have to teach LLVM to
lower prioritized global ctors on COFF as well.
This should let us compile some silly uses of this pragma in WebKit /
Blink.
Reviewers: rsmith, majnemer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4549
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAttr.cpp')
-rw-r--r-- | lib/Sema/SemaAttr.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index 7c182a1c64..a7d606d545 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -431,6 +431,15 @@ void Sema::ActOnPragmaMSSection(SourceLocation PragmaLocation, UnifySection(SegmentName->getString(), SectionFlags, PragmaLocation); } +void Sema::ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, + StringLiteral *SegmentName) { + // There's no stack to maintain, so we just have a current section. When we + // see the default section, reset our current section back to null so we stop + // tacking on unnecessary attributes. + CurInitSeg = SegmentName->getString() == ".CRT$XCU" ? nullptr : SegmentName; + CurInitSegLoc = PragmaLocation; +} + void Sema::ActOnPragmaUnused(const Token &IdTok, Scope *curScope, SourceLocation PragmaLoc) { |