aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h')
-rw-r--r--contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h444
1 files changed, 222 insertions, 222 deletions
diff --git a/contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h b/contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h
index b73462911e..ce0a7dd0f5 100644
--- a/contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h
+++ b/contrib/libs/llvm12/include/llvm/TableGen/DirectiveEmitter.h
@@ -1,222 +1,222 @@
-#pragma once
-
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#endif
-
-#ifndef LLVM_TABLEGEN_DIRECTIVEEMITTER_H
-#define LLVM_TABLEGEN_DIRECTIVEEMITTER_H
-
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/TableGen/Record.h"
-
-namespace llvm {
-
-// Wrapper class that contains DirectiveLanguage's information defined in
-// DirectiveBase.td and provides helper methods for accessing it.
-class DirectiveLanguage {
-public:
- explicit DirectiveLanguage(const llvm::RecordKeeper &Records)
- : Records(Records) {
- const auto &DirectiveLanguages = getDirectiveLanguages();
- Def = DirectiveLanguages[0];
- }
-
- StringRef getName() const { return Def->getValueAsString("name"); }
-
- StringRef getCppNamespace() const {
- return Def->getValueAsString("cppNamespace");
- }
-
- StringRef getDirectivePrefix() const {
- return Def->getValueAsString("directivePrefix");
- }
-
- StringRef getClausePrefix() const {
- return Def->getValueAsString("clausePrefix");
- }
-
- StringRef getIncludeHeader() const {
- return Def->getValueAsString("includeHeader");
- }
-
- StringRef getClauseEnumSetClass() const {
- return Def->getValueAsString("clauseEnumSetClass");
- }
-
- StringRef getFlangClauseBaseClass() const {
- return Def->getValueAsString("flangClauseBaseClass");
- }
-
- bool hasMakeEnumAvailableInNamespace() const {
- return Def->getValueAsBit("makeEnumAvailableInNamespace");
- }
-
- bool hasEnableBitmaskEnumInNamespace() const {
- return Def->getValueAsBit("enableBitmaskEnumInNamespace");
- }
-
- const std::vector<Record *> getDirectives() const {
- return Records.getAllDerivedDefinitions("Directive");
- }
-
- const std::vector<Record *> getClauses() const {
- return Records.getAllDerivedDefinitions("Clause");
- }
-
- bool HasValidityErrors() const;
-
-private:
- const llvm::Record *Def;
- const llvm::RecordKeeper &Records;
-
- const std::vector<Record *> getDirectiveLanguages() const {
- return Records.getAllDerivedDefinitions("DirectiveLanguage");
- }
-};
-
-// Base record class used for Directive and Clause class defined in
-// DirectiveBase.td.
-class BaseRecord {
-public:
- explicit BaseRecord(const llvm::Record *Def) : Def(Def) {}
-
- StringRef getName() const { return Def->getValueAsString("name"); }
-
- StringRef getAlternativeName() const {
- return Def->getValueAsString("alternativeName");
- }
-
- // Returns the name of the directive formatted for output. Whitespace are
- // replaced with underscores.
- std::string getFormattedName() {
- StringRef Name = Def->getValueAsString("name");
- std::string N = Name.str();
- std::replace(N.begin(), N.end(), ' ', '_');
- return N;
- }
-
- bool isDefault() const { return Def->getValueAsBit("isDefault"); }
-
- // Returns the record name.
- const StringRef getRecordName() const { return Def->getName(); }
-
-protected:
- const llvm::Record *Def;
-};
-
-// Wrapper class that contains a Directive's information defined in
-// DirectiveBase.td and provides helper methods for accessing it.
-class Directive : public BaseRecord {
-public:
- explicit Directive(const llvm::Record *Def) : BaseRecord(Def) {}
-
- std::vector<Record *> getAllowedClauses() const {
- return Def->getValueAsListOfDefs("allowedClauses");
- }
-
- std::vector<Record *> getAllowedOnceClauses() const {
- return Def->getValueAsListOfDefs("allowedOnceClauses");
- }
-
- std::vector<Record *> getAllowedExclusiveClauses() const {
- return Def->getValueAsListOfDefs("allowedExclusiveClauses");
- }
-
- std::vector<Record *> getRequiredClauses() const {
- return Def->getValueAsListOfDefs("requiredClauses");
- }
-};
-
-// Wrapper class that contains Clause's information defined in DirectiveBase.td
-// and provides helper methods for accessing it.
-class Clause : public BaseRecord {
-public:
- explicit Clause(const llvm::Record *Def) : BaseRecord(Def) {}
-
- // Optional field.
- StringRef getClangClass() const {
- return Def->getValueAsString("clangClass");
- }
-
- // Optional field.
- StringRef getFlangClass() const {
- return Def->getValueAsString("flangClass");
- }
-
- // Get the formatted name for Flang parser class. The generic formatted class
- // name is constructed from the name were the first letter of each word is
- // captitalized and the underscores are removed.
- // ex: async -> Async
- // num_threads -> NumThreads
- std::string getFormattedParserClassName() {
- StringRef Name = Def->getValueAsString("name");
- std::string N = Name.str();
- bool Cap = true;
- std::transform(N.begin(), N.end(), N.begin(), [&Cap](unsigned char C) {
- if (Cap == true) {
- C = llvm::toUpper(C);
- Cap = false;
- } else if (C == '_') {
- Cap = true;
- }
- return C;
- });
- N.erase(std::remove(N.begin(), N.end(), '_'), N.end());
- return N;
- }
-
- // Optional field.
- StringRef getEnumName() const {
- return Def->getValueAsString("enumClauseValue");
- }
-
- std::vector<Record *> getClauseVals() const {
- return Def->getValueAsListOfDefs("allowedClauseValues");
- }
-
- bool isValueOptional() const { return Def->getValueAsBit("isValueOptional"); }
-
- bool isValueList() const { return Def->getValueAsBit("isValueList"); }
-
- StringRef getDefaultValue() const {
- return Def->getValueAsString("defaultValue");
- }
-
- bool isImplicit() const { return Def->getValueAsBit("isImplicit"); }
-};
-
-// Wrapper class that contains VersionedClause's information defined in
-// DirectiveBase.td and provides helper methods for accessing it.
-class VersionedClause {
-public:
- explicit VersionedClause(const llvm::Record *Def) : Def(Def) {}
-
- // Return the specific clause record wrapped in the Clause class.
- Clause getClause() const { return Clause{Def->getValueAsDef("clause")}; }
-
- int64_t getMinVersion() const { return Def->getValueAsInt("minVersion"); }
-
- int64_t getMaxVersion() const { return Def->getValueAsInt("maxVersion"); }
-
-private:
- const llvm::Record *Def;
-};
-
-class ClauseVal : public BaseRecord {
-public:
- explicit ClauseVal(const llvm::Record *Def) : BaseRecord(Def) {}
-
- int getValue() const { return Def->getValueAsInt("value"); }
-
- bool isUserVisible() const { return Def->getValueAsBit("isUserValue"); }
-};
-
-} // namespace llvm
-
-#endif
-
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
+#pragma once
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
+#ifndef LLVM_TABLEGEN_DIRECTIVEEMITTER_H
+#define LLVM_TABLEGEN_DIRECTIVEEMITTER_H
+
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/TableGen/Record.h"
+
+namespace llvm {
+
+// Wrapper class that contains DirectiveLanguage's information defined in
+// DirectiveBase.td and provides helper methods for accessing it.
+class DirectiveLanguage {
+public:
+ explicit DirectiveLanguage(const llvm::RecordKeeper &Records)
+ : Records(Records) {
+ const auto &DirectiveLanguages = getDirectiveLanguages();
+ Def = DirectiveLanguages[0];
+ }
+
+ StringRef getName() const { return Def->getValueAsString("name"); }
+
+ StringRef getCppNamespace() const {
+ return Def->getValueAsString("cppNamespace");
+ }
+
+ StringRef getDirectivePrefix() const {
+ return Def->getValueAsString("directivePrefix");
+ }
+
+ StringRef getClausePrefix() const {
+ return Def->getValueAsString("clausePrefix");
+ }
+
+ StringRef getIncludeHeader() const {
+ return Def->getValueAsString("includeHeader");
+ }
+
+ StringRef getClauseEnumSetClass() const {
+ return Def->getValueAsString("clauseEnumSetClass");
+ }
+
+ StringRef getFlangClauseBaseClass() const {
+ return Def->getValueAsString("flangClauseBaseClass");
+ }
+
+ bool hasMakeEnumAvailableInNamespace() const {
+ return Def->getValueAsBit("makeEnumAvailableInNamespace");
+ }
+
+ bool hasEnableBitmaskEnumInNamespace() const {
+ return Def->getValueAsBit("enableBitmaskEnumInNamespace");
+ }
+
+ const std::vector<Record *> getDirectives() const {
+ return Records.getAllDerivedDefinitions("Directive");
+ }
+
+ const std::vector<Record *> getClauses() const {
+ return Records.getAllDerivedDefinitions("Clause");
+ }
+
+ bool HasValidityErrors() const;
+
+private:
+ const llvm::Record *Def;
+ const llvm::RecordKeeper &Records;
+
+ const std::vector<Record *> getDirectiveLanguages() const {
+ return Records.getAllDerivedDefinitions("DirectiveLanguage");
+ }
+};
+
+// Base record class used for Directive and Clause class defined in
+// DirectiveBase.td.
+class BaseRecord {
+public:
+ explicit BaseRecord(const llvm::Record *Def) : Def(Def) {}
+
+ StringRef getName() const { return Def->getValueAsString("name"); }
+
+ StringRef getAlternativeName() const {
+ return Def->getValueAsString("alternativeName");
+ }
+
+ // Returns the name of the directive formatted for output. Whitespace are
+ // replaced with underscores.
+ std::string getFormattedName() {
+ StringRef Name = Def->getValueAsString("name");
+ std::string N = Name.str();
+ std::replace(N.begin(), N.end(), ' ', '_');
+ return N;
+ }
+
+ bool isDefault() const { return Def->getValueAsBit("isDefault"); }
+
+ // Returns the record name.
+ const StringRef getRecordName() const { return Def->getName(); }
+
+protected:
+ const llvm::Record *Def;
+};
+
+// Wrapper class that contains a Directive's information defined in
+// DirectiveBase.td and provides helper methods for accessing it.
+class Directive : public BaseRecord {
+public:
+ explicit Directive(const llvm::Record *Def) : BaseRecord(Def) {}
+
+ std::vector<Record *> getAllowedClauses() const {
+ return Def->getValueAsListOfDefs("allowedClauses");
+ }
+
+ std::vector<Record *> getAllowedOnceClauses() const {
+ return Def->getValueAsListOfDefs("allowedOnceClauses");
+ }
+
+ std::vector<Record *> getAllowedExclusiveClauses() const {
+ return Def->getValueAsListOfDefs("allowedExclusiveClauses");
+ }
+
+ std::vector<Record *> getRequiredClauses() const {
+ return Def->getValueAsListOfDefs("requiredClauses");
+ }
+};
+
+// Wrapper class that contains Clause's information defined in DirectiveBase.td
+// and provides helper methods for accessing it.
+class Clause : public BaseRecord {
+public:
+ explicit Clause(const llvm::Record *Def) : BaseRecord(Def) {}
+
+ // Optional field.
+ StringRef getClangClass() const {
+ return Def->getValueAsString("clangClass");
+ }
+
+ // Optional field.
+ StringRef getFlangClass() const {
+ return Def->getValueAsString("flangClass");
+ }
+
+ // Get the formatted name for Flang parser class. The generic formatted class
+ // name is constructed from the name were the first letter of each word is
+ // captitalized and the underscores are removed.
+ // ex: async -> Async
+ // num_threads -> NumThreads
+ std::string getFormattedParserClassName() {
+ StringRef Name = Def->getValueAsString("name");
+ std::string N = Name.str();
+ bool Cap = true;
+ std::transform(N.begin(), N.end(), N.begin(), [&Cap](unsigned char C) {
+ if (Cap == true) {
+ C = llvm::toUpper(C);
+ Cap = false;
+ } else if (C == '_') {
+ Cap = true;
+ }
+ return C;
+ });
+ N.erase(std::remove(N.begin(), N.end(), '_'), N.end());
+ return N;
+ }
+
+ // Optional field.
+ StringRef getEnumName() const {
+ return Def->getValueAsString("enumClauseValue");
+ }
+
+ std::vector<Record *> getClauseVals() const {
+ return Def->getValueAsListOfDefs("allowedClauseValues");
+ }
+
+ bool isValueOptional() const { return Def->getValueAsBit("isValueOptional"); }
+
+ bool isValueList() const { return Def->getValueAsBit("isValueList"); }
+
+ StringRef getDefaultValue() const {
+ return Def->getValueAsString("defaultValue");
+ }
+
+ bool isImplicit() const { return Def->getValueAsBit("isImplicit"); }
+};
+
+// Wrapper class that contains VersionedClause's information defined in
+// DirectiveBase.td and provides helper methods for accessing it.
+class VersionedClause {
+public:
+ explicit VersionedClause(const llvm::Record *Def) : Def(Def) {}
+
+ // Return the specific clause record wrapped in the Clause class.
+ Clause getClause() const { return Clause{Def->getValueAsDef("clause")}; }
+
+ int64_t getMinVersion() const { return Def->getValueAsInt("minVersion"); }
+
+ int64_t getMaxVersion() const { return Def->getValueAsInt("maxVersion"); }
+
+private:
+ const llvm::Record *Def;
+};
+
+class ClauseVal : public BaseRecord {
+public:
+ explicit ClauseVal(const llvm::Record *Def) : BaseRecord(Def) {}
+
+ int getValue() const { return Def->getValueAsInt("value"); }
+
+ bool isUserVisible() const { return Def->getValueAsBit("isUserValue"); }
+};
+
+} // namespace llvm
+
+#endif
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif