aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 8c5362b..7c0d6c3 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -834,6 +834,48 @@ public:
};
FPOptions CurFPFeatures;
+ class CGAtomicOptionsRAII {
+ public:
+ CGAtomicOptionsRAII(CodeGenModule &CGM_, AtomicOptions AO)
+ : CGM(CGM_), SavedAtomicOpts(CGM.getAtomicOpts()) {
+ CGM.setAtomicOpts(AO);
+ }
+ CGAtomicOptionsRAII(CodeGenModule &CGM_, const AtomicAttr *AA)
+ : CGM(CGM_), SavedAtomicOpts(CGM.getAtomicOpts()) {
+ if (!AA)
+ return;
+ AtomicOptions AO = SavedAtomicOpts;
+ for (auto Option : AA->atomicOptions()) {
+ switch (Option) {
+ case AtomicAttr::remote_memory:
+ AO.remote_memory = true;
+ break;
+ case AtomicAttr::no_remote_memory:
+ AO.remote_memory = false;
+ break;
+ case AtomicAttr::fine_grained_memory:
+ AO.fine_grained_memory = true;
+ break;
+ case AtomicAttr::no_fine_grained_memory:
+ AO.fine_grained_memory = false;
+ break;
+ case AtomicAttr::ignore_denormal_mode:
+ AO.ignore_denormal_mode = true;
+ break;
+ case AtomicAttr::no_ignore_denormal_mode:
+ AO.ignore_denormal_mode = false;
+ break;
+ }
+ }
+ CGM.setAtomicOpts(AO);
+ }
+ ~CGAtomicOptionsRAII() { CGM.setAtomicOpts(SavedAtomicOpts); }
+
+ private:
+ CodeGenModule &CGM;
+ AtomicOptions SavedAtomicOpts;
+ };
+
public:
/// ObjCEHValueStack - Stack of Objective-C exception values, used for
/// rethrows.