summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAttr.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-04-04 21:18:36 +0000
committerAdam Nemet <anemet@apple.com>2017-04-04 21:18:36 +0000
commit60d3264d5fbe08fa93601ca40489d7c328941d0e (patch)
treef28ce77a814d59110c11f828ba70adbb60026172 /clang/lib/Sema/SemaAttr.cpp
parent370d0877f6271a3cb88a6d07dade3438ccd9bbae (diff)
downloadbcm5719-llvm-60d3264d5fbe08fa93601ca40489d7c328941d0e.tar.gz
bcm5719-llvm-60d3264d5fbe08fa93601ca40489d7c328941d0e.zip
Add #pragma clang fp
This adds the new pragma and the first variant, contract(on/off/fast). The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be placed at the beginning of a compound statement or at file scope. Similarly to STDC FP_CONTRACT there is no need to use attributes. First an annotate token is inserted with the parsed details of the pragma. Then the annotate token is parsed in the proper contexts and the Sema is updated with the corresponding FPOptions using the shared ActOn function with STDC FP_CONTRACT. After this the FPOptions from the Sema is propagated into the AST expression nodes. There is no change here. I was going to add a 'default' option besides 'on/off/fast' similar to STDC FP_CONTRACT but then decided against it. I think that we'd have to make option uppercase then to avoid using 'default' the keyword. Also because of the scoped activation of pragma I am not sure there is really a need a for this. Differential Revision: https://reviews.llvm.org/D31276 llvm-svn: 299470
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaAttr.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index 3ffaab23a18..c6e3cc88631 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -448,19 +448,16 @@ void Sema::ActOnPragmaVisibility(const IdentifierInfo* VisType,
}
}
-void Sema::ActOnPragmaFPContract(tok::OnOffSwitch OOS) {
- switch (OOS) {
- case tok::OOS_ON:
+void Sema::ActOnPragmaFPContract(LangOptions::FPContractModeKind FPC) {
+ switch (FPC) {
+ case LangOptions::FPC_On:
FPFeatures.setAllowFPContractWithinStatement();
break;
- case tok::OOS_OFF:
- FPFeatures.setDisallowFPContract();
+ case LangOptions::FPC_Fast:
+ FPFeatures.setAllowFPContractAcrossStatement();
break;
- case tok::OOS_DEFAULT:
- if (getLangOpts().getDefaultFPContractMode() == LangOptions::FPC_On)
- FPFeatures.setAllowFPContractWithinStatement();
- else
- FPFeatures.setDisallowFPContract();
+ case LangOptions::FPC_Off:
+ FPFeatures.setDisallowFPContract();
break;
}
}
OpenPOWER on IntegriCloud