diff options
author | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-28 11:32:10 +0000 |
---|---|---|
committer | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-28 11:32:10 +0000 |
commit | 801d9b0cc4dca8a5ce190ac51b0c412263e95d95 (patch) | |
tree | 9372ed0988288737d357000051bef94377cf79ac /clang/lib/Sema/SemaAttr.cpp | |
parent | 632fdc5919d9738a1174a347deef377dbe18f51b (diff) | |
download | bcm5719-llvm-801d9b0cc4dca8a5ce190ac51b0c412263e95d95.tar.gz bcm5719-llvm-801d9b0cc4dca8a5ce190ac51b0c412263e95d95.zip |
Revert "[MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)"
This reverts commit r267866.
llvm-svn: 267870
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaAttr.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp index 8474cf8b7cb..7f523c465af 100644 --- a/clang/lib/Sema/SemaAttr.cpp +++ b/clang/lib/Sema/SemaAttr.cpp @@ -136,9 +136,9 @@ void Sema::AddMsStructLayoutForRecord(RecordDecl *RD) { // FIXME: We should merge AddAlignmentAttributesForRecord with // AddMsStructLayoutForRecord into AddPragmaAttributesForRecord, which takes // all active pragmas and applies them as attributes to class definitions. - if (VtorDispStack.CurrentValue != getLangOpts().VtorDispMode) + if (VtorDispModeStack.back() != getLangOpts().VtorDispMode) RD->addAttr( - MSVtorDispAttr::CreateImplicit(Context, VtorDispStack.CurrentValue)); + MSVtorDispAttr::CreateImplicit(Context, VtorDispModeStack.back())); } void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, @@ -292,13 +292,29 @@ void Sema::ActOnPragmaMSPointersToMembers( ImplicitMSInheritanceAttrLoc = PragmaLoc; } -void Sema::ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, +void Sema::ActOnPragmaMSVtorDisp(PragmaVtorDispKind Kind, SourceLocation PragmaLoc, MSVtorDispAttr::Mode Mode) { - if (Action & PSK_Pop && VtorDispStack.Stack.empty()) - Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "vtordisp" - << "stack empty"; - VtorDispStack.Act(PragmaLoc, Action, StringRef(), Mode); + switch (Kind) { + case PVDK_Set: + VtorDispModeStack.back() = Mode; + break; + case PVDK_Push: + VtorDispModeStack.push_back(Mode); + break; + case PVDK_Reset: + VtorDispModeStack.clear(); + VtorDispModeStack.push_back(MSVtorDispAttr::Mode(LangOpts.VtorDispMode)); + break; + case PVDK_Pop: + VtorDispModeStack.pop_back(); + if (VtorDispModeStack.empty()) { + Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "vtordisp" + << "stack empty"; + VtorDispModeStack.push_back(MSVtorDispAttr::Mode(LangOpts.VtorDispMode)); + } + break; + } } template<typename ValueType> @@ -307,7 +323,7 @@ void Sema::PragmaStack<ValueType>::Act(SourceLocation PragmaLocation, llvm::StringRef StackSlotLabel, ValueType Value) { if (Action == PSK_Reset) { - CurrentValue = DefaultValue; + CurrentValue = nullptr; return; } if (Action & PSK_Push) |