[OpenMP][NFC] Remove the need to include `OpenMPClause.h`
See rational here: https://reviews.llvm.org/D76173#1922916
Time to compile Attr.h in isolation goes from 2.6s to 1.8s.
Original patch by Johannes, plus some additions from Reid to fix some
clang tooling targets.
Effect on transitive includes is marginal, though:
$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
| grep '^[-+] ' | sort | uniq -c | sort -nr
104 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/AST/OpenMPClause.h
87 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SmallSet.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SetVector.h
14 - /usr/include/c++/9/set
...
Differential Revision: https://reviews.llvm.org/D76184
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 1f5ed3d..4bec5f5 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/ASTContext.h"
+#include "clang/AST/OpenMPClause.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/TargetInfo.h"
@@ -865,7 +866,7 @@
} // namespace
void Parser::parseOMPTraitPropertyKind(
- OMPTraitInfo::OMPTraitProperty &TIProperty, llvm::omp::TraitSet Set,
+ OMPTraitProperty &TIProperty, llvm::omp::TraitSet Set,
llvm::omp::TraitSelector Selector, llvm::StringMap<SourceLocation> &Seen) {
TIProperty.Kind = TraitProperty::invalid;
@@ -934,14 +935,14 @@
<< CONTEXT_TRAIT_LVL << listOpenMPContextTraitProperties(Set, Selector);
}
-void Parser::parseOMPContextProperty(OMPTraitInfo::OMPTraitSelector &TISelector,
+void Parser::parseOMPContextProperty(OMPTraitSelector &TISelector,
llvm::omp::TraitSet Set,
llvm::StringMap<SourceLocation> &Seen) {
assert(TISelector.Kind != TraitSelector::user_condition &&
"User conditions are special properties not handled here!");
SourceLocation PropertyLoc = Tok.getLocation();
- OMPTraitInfo::OMPTraitProperty TIProperty;
+ OMPTraitProperty TIProperty;
parseOMPTraitPropertyKind(TIProperty, Set, TISelector.Kind, Seen);
// If we have an invalid property here we already issued a warning.
@@ -975,7 +976,7 @@
}
void Parser::parseOMPTraitSelectorKind(
- OMPTraitInfo::OMPTraitSelector &TISelector, llvm::omp::TraitSet Set,
+ OMPTraitSelector &TISelector, llvm::omp::TraitSet Set,
llvm::StringMap<SourceLocation> &Seen) {
TISelector.Kind = TraitSelector::invalid;
@@ -1054,7 +1055,7 @@
///
/// <trait-selector-name> ['('[<trait-score>] <trait-property> [, <t-p>]* ')']
void Parser::parseOMPContextSelector(
- OMPTraitInfo::OMPTraitSelector &TISelector, llvm::omp::TraitSet Set,
+ OMPTraitSelector &TISelector, llvm::omp::TraitSet Set,
llvm::StringMap<SourceLocation> &SeenSelectors) {
unsigned short OuterPC = ParenCount;
@@ -1160,7 +1161,7 @@
BDT.consumeClose();
}
-void Parser::parseOMPTraitSetKind(OMPTraitInfo::OMPTraitSet &TISet,
+void Parser::parseOMPTraitSetKind(OMPTraitSet &TISet,
llvm::StringMap<SourceLocation> &Seen) {
TISet.Kind = TraitSet::invalid;
@@ -1224,7 +1225,7 @@
///
/// <trait-set-selector-name> '=' '{' <trait-selector> [, <trait-selector>]* '}'
void Parser::parseOMPContextSelectorSet(
- OMPTraitInfo::OMPTraitSet &TISet,
+ OMPTraitSet &TISet,
llvm::StringMap<SourceLocation> &SeenSets) {
auto OuterBC = BraceCount;
@@ -1279,7 +1280,7 @@
llvm::StringMap<SourceLocation> SeenSelectors;
do {
- OMPTraitInfo::OMPTraitSelector TISelector;
+ OMPTraitSelector TISelector;
parseOMPContextSelector(TISelector, TISet.Kind, SeenSelectors);
if (TISelector.Kind != TraitSelector::invalid &&
!TISelector.Properties.empty())
@@ -1301,10 +1302,10 @@
/// Parse OpenMP context selectors:
///
/// <trait-set-selector> [, <trait-set-selector>]*
-bool Parser::parseOMPContextSelectors(SourceLocation Loc, OMPTraitInfo &TI) {
+bool Parser::parseOMPContextSelectors(SourceLocation Loc, OMPTraitInfo& TI) {
llvm::StringMap<SourceLocation> SeenSets;
do {
- OMPTraitInfo::OMPTraitSet TISet;
+ OMPTraitSet TISet;
parseOMPContextSelectorSet(TISet, SeenSets);
if (TISet.Kind != TraitSet::invalid && !TISet.Selectors.empty())
TI.Sets.push_back(TISet);