diff options
author | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-28 10:13:18 +0000 |
---|---|---|
committer | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-28 10:13:18 +0000 |
commit | 2008dbb4ed56a93f0cb6cbd90721d9c469442b5f (patch) | |
tree | fbef55ef756e132952b1e58bea6c918ade0024cc /clang/lib/Parse/ParsePragma.cpp | |
parent | 5b4faeec8705aeecd9c7d5cb90ece6f50c459195 (diff) | |
download | bcm5719-llvm-2008dbb4ed56a93f0cb6cbd90721d9c469442b5f.tar.gz bcm5719-llvm-2008dbb4ed56a93f0cb6cbd90721d9c469442b5f.zip |
[MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)
Rework implementation of several MS pragmas that use internal stack:
vtordisp, {bss|code|const|data}_seg.
This patch:
1. Makes #pragma vtordisp use PragmaStack class as *_seg pragmas do;
2. Fixes "#pragma vtordisp()" behavior: it shouldn't affect stack;
3. Saves/restores the stacks on enter/exit a C++ method body.
llvm-svn: 267866
Diffstat (limited to 'clang/lib/Parse/ParsePragma.cpp')
-rw-r--r-- | clang/lib/Parse/ParsePragma.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp index 2352fbe4d8d..adeac132b00 100644 --- a/clang/lib/Parse/ParsePragma.cpp +++ b/clang/lib/Parse/ParsePragma.cpp @@ -497,11 +497,11 @@ void Parser::HandlePragmaMSPointersToMembers() { void Parser::HandlePragmaMSVtorDisp() { assert(Tok.is(tok::annot_pragma_ms_vtordisp)); uintptr_t Value = reinterpret_cast<uintptr_t>(Tok.getAnnotationValue()); - Sema::PragmaVtorDispKind Kind = - static_cast<Sema::PragmaVtorDispKind>((Value >> 16) & 0xFFFF); + Sema::PragmaMsStackAction Action = + static_cast<Sema::PragmaMsStackAction>((Value >> 16) & 0xFFFF); MSVtorDispAttr::Mode Mode = MSVtorDispAttr::Mode(Value & 0xFFFF); SourceLocation PragmaLoc = ConsumeToken(); // The annotation token. - Actions.ActOnPragmaMSVtorDisp(Kind, PragmaLoc, Mode); + Actions.ActOnPragmaMSVtorDisp(Action, PragmaLoc, Mode); } void Parser::HandlePragmaMSPragma() { @@ -1606,7 +1606,7 @@ void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP, } PP.Lex(Tok); - Sema::PragmaVtorDispKind Kind = Sema::PVDK_Set; + Sema::PragmaMsStackAction Action = Sema::PSK_Set; const IdentifierInfo *II = Tok.getIdentifierInfo(); if (II) { if (II->isStr("push")) { @@ -1617,24 +1617,24 @@ void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP, return; } PP.Lex(Tok); - Kind = Sema::PVDK_Push; + Action = Sema::PSK_Push_Set; // not push, could be on/off } else if (II->isStr("pop")) { // #pragma vtordisp(pop) PP.Lex(Tok); - Kind = Sema::PVDK_Pop; + Action = Sema::PSK_Pop; } // not push or pop, could be on/off } else { if (Tok.is(tok::r_paren)) { // #pragma vtordisp() - Kind = Sema::PVDK_Reset; + Action = Sema::PSK_Reset; } } uint64_t Value = 0; - if (Kind == Sema::PVDK_Push || Kind == Sema::PVDK_Set) { + if (Action & Sema::PSK_Push || Action & Sema::PSK_Set) { const IdentifierInfo *II = Tok.getIdentifierInfo(); if (II && II->isStr("off")) { PP.Lex(Tok); @@ -1676,7 +1676,7 @@ void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP, AnnotTok.setLocation(VtorDispLoc); AnnotTok.setAnnotationEndLoc(EndLoc); AnnotTok.setAnnotationValue(reinterpret_cast<void *>( - static_cast<uintptr_t>((Kind << 16) | (Value & 0xFFFF)))); + static_cast<uintptr_t>((Action << 16) | (Value & 0xFFFF)))); PP.EnterToken(AnnotTok); } |