1 //===-- lib/Common/Fortran-features.cpp -----------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "flang/Common/Fortran-features.h"
10 #include "flang/Common/Fortran.h"
11 #include "flang/Common/idioms.h"
13 namespace Fortran::common
{
15 std::vector
<const char *> LanguageFeatureControl::GetNames(
16 LogicalOperator opr
) const {
17 std::vector
<const char *> result
;
18 result
.push_back(AsFortran(opr
));
19 if (opr
== LogicalOperator::Neqv
&& IsEnabled(LanguageFeature::XOROperator
)) {
20 result
.push_back(".xor.");
22 if (IsEnabled(LanguageFeature::LogicalAbbreviations
)) {
24 SWITCH_COVERS_ALL_CASES
25 case LogicalOperator::And
:
26 result
.push_back(".a.");
28 case LogicalOperator::Or
:
29 result
.push_back(".o.");
31 case LogicalOperator::Not
:
32 result
.push_back(".n.");
34 case LogicalOperator::Neqv
:
35 if (IsEnabled(LanguageFeature::XOROperator
)) {
36 result
.push_back(".x.");
39 case LogicalOperator::Eqv
:
46 std::vector
<const char *> LanguageFeatureControl::GetNames(
47 RelationalOperator opr
) const {
49 SWITCH_COVERS_ALL_CASES
50 case RelationalOperator::LT
:
52 case RelationalOperator::LE
:
53 return {".le.", "<="};
54 case RelationalOperator::EQ
:
55 return {".eq.", "=="};
56 case RelationalOperator::GE
:
57 return {".ge.", ">="};
58 case RelationalOperator::GT
:
60 case RelationalOperator::NE
:
61 if (IsEnabled(LanguageFeature::AlternativeNE
)) {
62 return {".ne.", "/=", "<>"};
64 return {".ne.", "/="};
69 } // namespace Fortran::common