Skip to content

Commit

Permalink
[OpenMP][NFC] Open llvm and llvm::omp namespace in OpenMPClause.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jdoerfert committed Mar 27, 2020
1 parent 56d1553 commit b293224
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions clang/lib/AST/OpenMPClause.cpp
Expand Up @@ -24,6 +24,8 @@
#include <cassert>

using namespace clang;
using namespace llvm;
using namespace omp;

OMPClause::child_range OMPClause::children() {
switch (getClauseKind()) {
Expand Down Expand Up @@ -1296,7 +1298,7 @@ OMPExclusiveClause *OMPExclusiveClause::CreateEmpty(const ASTContext &C,

void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {
OS << "if(";
if (Node->getNameModifier() != llvm::omp::OMPD_unknown)
if (Node->getNameModifier() != OMPD_unknown)
OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";
Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
OS << ")";
Expand Down Expand Up @@ -1867,24 +1869,24 @@ void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {
}

void OMPTraitInfo::getAsVariantMatchInfo(
ASTContext &ASTCtx, llvm::omp::VariantMatchInfo &VMI) const {
ASTContext &ASTCtx, VariantMatchInfo &VMI) const {
for (const OMPTraitSet &Set : Sets) {
for (const OMPTraitSelector &Selector : Set.Selectors) {

// User conditions are special as we evaluate the condition here.
if (Selector.Kind == llvm::omp::TraitSelector::user_condition) {
if (Selector.Kind == TraitSelector::user_condition) {
assert(Selector.ScoreOrCondition &&
"Ill-formed user condition, expected condition expression!");
assert(Selector.Properties.size() == 1 &&
Selector.Properties.front().Kind ==
llvm::omp::TraitProperty::user_condition_unknown &&
TraitProperty::user_condition_unknown &&
"Ill-formed user condition, expected unknown trait property!");

llvm::APInt CondVal =
Selector.ScoreOrCondition->EvaluateKnownConstInt(ASTCtx);
VMI.addTrait(CondVal.isNullValue()
? llvm::omp::TraitProperty::user_condition_false
: llvm::omp::TraitProperty::user_condition_true);
? TraitProperty::user_condition_false
: TraitProperty::user_condition_true);
continue;
}

Expand All @@ -1897,13 +1899,13 @@ void OMPTraitInfo::getAsVariantMatchInfo(
for (const OMPTraitProperty &Property : Selector.Properties)
VMI.addTrait(Set.Kind, Property.Kind, ScorePtr);

if (Set.Kind != llvm::omp::TraitSet::construct)
if (Set.Kind != TraitSet::construct)
continue;

// TODO: This might not hold once we implement SIMD properly.
assert(Selector.Properties.size() == 1 &&
Selector.Properties.front().Kind ==
llvm::omp::getOpenMPContextTraitPropertyForSelector(
getOpenMPContextTraitPropertyForSelector(
Selector.Kind) &&
"Ill-formed construct selector!");

Expand All @@ -1919,25 +1921,25 @@ void OMPTraitInfo::print(llvm::raw_ostream &OS,
if (!FirstSet)
OS << ", ";
FirstSet = false;
OS << llvm::omp::getOpenMPContextTraitSetName(Set.Kind) << "={";
OS << getOpenMPContextTraitSetName(Set.Kind) << "={";

bool FirstSelector = true;
for (const OMPTraitInfo::OMPTraitSelector &Selector : Set.Selectors) {
if (!FirstSelector)
OS << ", ";
FirstSelector = false;
OS << llvm::omp::getOpenMPContextTraitSelectorName(Selector.Kind);
OS << getOpenMPContextTraitSelectorName(Selector.Kind);

bool AllowsTraitScore = false;
bool RequiresProperty = false;
llvm::omp::isValidTraitSelectorForTraitSet(
isValidTraitSelectorForTraitSet(
Selector.Kind, Set.Kind, AllowsTraitScore, RequiresProperty);

if (!RequiresProperty)
continue;

OS << "(";
if (Selector.Kind == llvm::omp::TraitSelector::user_condition) {
if (Selector.Kind == TraitSelector::user_condition) {
Selector.ScoreOrCondition->printPretty(OS, nullptr, Policy);
} else {

Expand All @@ -1953,7 +1955,7 @@ void OMPTraitInfo::print(llvm::raw_ostream &OS,
if (!FirstProperty)
OS << ", ";
FirstProperty = false;
OS << llvm::omp::getOpenMPContextTraitPropertyName(Property.Kind);
OS << getOpenMPContextTraitPropertyName(Property.Kind);
}
}
OS << ")";
Expand Down

0 comments on commit b293224

Please sign in to comment.