[clang] [NFC][clang][TableGen] Remove redundant llvm:: namespace qualifier (PR #108627)
Rahul Joshi via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 11:58:35 PDT 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/108627
Remove llvm:: from .cpp files, and add "using namespace llvm" if needed.
>From 73a8e42a15441b38a1d88e2fd4de0dd420a33398 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Fri, 13 Sep 2024 11:55:45 -0700
Subject: [PATCH] [NFC][clang][TableGen] Remove redundant llvm:: namespace
qualifier
Remove llvm:: from .cpp files, and add "using namespace llvm" if
needed.
---
clang/utils/TableGen/ASTTableGen.cpp | 2 +-
.../TableGen/ClangASTPropertiesEmitter.cpp | 3 +-
clang/utils/TableGen/ClangAttrEmitter.cpp | 135 ++++++++----------
clang/utils/TableGen/ClangBuiltinsEmitter.cpp | 20 ++-
.../TableGen/ClangDiagnosticsEmitter.cpp | 61 ++++----
clang/utils/TableGen/ClangOpcodesEmitter.cpp | 4 +-
.../TableGen/ClangOpenCLBuiltinEmitter.cpp | 7 +-
.../utils/TableGen/ClangOptionDocEmitter.cpp | 6 +-
.../utils/TableGen/ClangSACheckersEmitter.cpp | 9 +-
clang/utils/TableGen/ClangSyntaxEmitter.cpp | 50 +++----
clang/utils/TableGen/MveEmitter.cpp | 12 +-
clang/utils/TableGen/NeonEmitter.cpp | 32 ++---
clang/utils/TableGen/RISCVVEmitter.cpp | 6 +-
clang/utils/TableGen/SveEmitter.cpp | 44 +++---
14 files changed, 186 insertions(+), 205 deletions(-)
diff --git a/clang/utils/TableGen/ASTTableGen.cpp b/clang/utils/TableGen/ASTTableGen.cpp
index 47344777e9311a..46bb6c21997f09 100644
--- a/clang/utils/TableGen/ASTTableGen.cpp
+++ b/clang/utils/TableGen/ASTTableGen.cpp
@@ -21,7 +21,7 @@ using namespace llvm;
using namespace clang;
using namespace clang::tblgen;
-llvm::StringRef clang::tblgen::HasProperties::getName() const {
+StringRef clang::tblgen::HasProperties::getName() const {
if (auto node = getAs<ASTNode>()) {
return node.getName();
} else if (auto typeCase = getAs<TypeCase>()) {
diff --git a/clang/utils/TableGen/ClangASTPropertiesEmitter.cpp b/clang/utils/TableGen/ClangASTPropertiesEmitter.cpp
index 2d67b6b643637c..3151ff199f5762 100644
--- a/clang/utils/TableGen/ClangASTPropertiesEmitter.cpp
+++ b/clang/utils/TableGen/ClangASTPropertiesEmitter.cpp
@@ -205,8 +205,7 @@ class ASTPropsEmitter {
void visitAllNodesWithInfo(
HasProperties derivedNode, const NodeInfo &derivedNodeInfo,
- llvm::function_ref<void(HasProperties node, const NodeInfo &info)>
- visit) {
+ function_ref<void(HasProperties node, const NodeInfo &info)> visit) {
visit(derivedNode, derivedNodeInfo);
// Also walk the bases if appropriate.
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 9b2249ac90bc5c..f593f6428fe4cc 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -1475,7 +1475,7 @@ createArgument(const Record &Arg, StringRef Attr,
Search = &Arg;
std::unique_ptr<Argument> Ptr;
- llvm::StringRef ArgName = Search->getName();
+ StringRef ArgName = Search->getName();
if (ArgName == "AlignedArgument")
Ptr = std::make_unique<AlignedArgument>(Arg, Attr);
@@ -1532,7 +1532,7 @@ createArgument(const Record &Arg, StringRef Attr,
if (!Ptr) {
// Search in reverse order so that the most-derived type is handled first.
ArrayRef<std::pair<Record*, SMRange>> Bases = Search->getSuperClasses();
- for (const auto &Base : llvm::reverse(Bases)) {
+ for (const auto &Base : reverse(Bases)) {
if ((Ptr = createArgument(Arg, Attr, Base.first)))
break;
}
@@ -1611,11 +1611,11 @@ writePrettyPrintFunction(const Record &R,
<< " break;\n";
for (unsigned I = 0; I < Spellings.size(); ++ I) {
- llvm::SmallString<16> Prefix;
- llvm::SmallString<8> Suffix;
+ SmallString<16> Prefix;
+ SmallString<8> Suffix;
// The actual spelling of the name and namespace (if applicable)
// of an attribute without considering prefix and suffix.
- llvm::SmallString<64> Spelling;
+ SmallString<64> Spelling;
std::string Name = Spellings[I].name();
std::string Variety = Spellings[I].variety();
@@ -1680,7 +1680,7 @@ writePrettyPrintFunction(const Record &R,
// printing spurious commas at the end of an argument list, we need to
// determine where the last provided non-fake argument is.
bool FoundNonOptArg = false;
- for (const auto &arg : llvm::reverse(Args)) {
+ for (const auto &arg : reverse(Args)) {
if (arg->isFake())
continue;
if (FoundNonOptArg)
@@ -1776,7 +1776,7 @@ SpellingNamesAreCommon(const std::vector<FlattenedSpelling>& Spellings) {
assert(!Spellings.empty() && "An empty list of spellings was provided");
std::string FirstName =
std::string(NormalizeNameForSpellingComparison(Spellings.front().name()));
- for (const auto &Spelling : llvm::drop_begin(Spellings)) {
+ for (const auto &Spelling : drop_begin(Spellings)) {
std::string Name =
std::string(NormalizeNameForSpellingComparison(Spelling.name()));
if (Name != FirstName)
@@ -1834,7 +1834,7 @@ CreateSemanticSpellings(const std::vector<FlattenedSpelling> &Spellings,
// enumeration, but the spelling index and semantic spelling values are
// meant to be equivalent, so we must specify a concrete value for each
// enumerator.
- Ret += " " + EnumName + " = " + llvm::utostr(Idx);
+ Ret += " " + EnumName + " = " + utostr(Idx);
}
Ret += ",\n SpellingNotCalculated = 15\n";
Ret += "\n };\n\n";
@@ -1871,15 +1871,14 @@ static LateAttrParseKind getLateAttrParseKind(const Record *Attr) {
SmallVector<Record *, 1> SuperClasses;
LAPK->getDirectSuperClasses(SuperClasses);
if (SuperClasses.size() != 1)
- PrintFatalError(Attr, "Field `" + llvm::Twine(LateParsedStr) +
+ PrintFatalError(Attr, "Field `" + Twine(LateParsedStr) +
"`should only have one super class");
if (SuperClasses[0]->getName() != LateAttrParseKindStr)
- PrintFatalError(Attr, "Field `" + llvm::Twine(LateParsedStr) +
- "`should only have type `" +
- llvm::Twine(LateAttrParseKindStr) +
- "` but found type `" +
- SuperClasses[0]->getName() + "`");
+ PrintFatalError(
+ Attr, "Field `" + Twine(LateParsedStr) + "`should only have type `" +
+ Twine(LateAttrParseKindStr) + "` but found type `" +
+ SuperClasses[0]->getName() + "`");
// Get Kind and verify the enum name matches the name in `Attr.td`.
unsigned Kind = LAPK->getValueAsInt(KindFieldStr);
@@ -1887,11 +1886,11 @@ static LateAttrParseKind getLateAttrParseKind(const Record *Attr) {
#define CASE(X) \
case LateAttrParseKind::X: \
if (LAPK->getName().compare("LateAttrParse" #X) != 0) { \
- PrintFatalError(Attr, \
- "Field `" + llvm::Twine(LateParsedStr) + "` set to `" + \
- LAPK->getName() + \
- "` but this converts to `LateAttrParseKind::" + \
- llvm::Twine(#X) + "`"); \
+ PrintFatalError( \
+ Attr, \
+ "Field `" + Twine(LateParsedStr) + "` set to `" + LAPK->getName() + \
+ "` but this converts to `LateAttrParseKind::" + Twine(#X) + \
+ "`"); \
} \
return LateAttrParseKind::X;
@@ -1902,11 +1901,10 @@ static LateAttrParseKind getLateAttrParseKind(const Record *Attr) {
}
// The Kind value is completely invalid
- auto KindValueStr = llvm::utostr(Kind);
- PrintFatalError(Attr, "Field `" + llvm::Twine(LateParsedStr) + "` set to `" +
+ auto KindValueStr = utostr(Kind);
+ PrintFatalError(Attr, "Field `" + Twine(LateParsedStr) + "` set to `" +
LAPK->getName() + "` has unexpected `" +
- llvm::Twine(KindFieldStr) + "` value of " +
- KindValueStr);
+ Twine(KindFieldStr) + "` value of " + KindValueStr);
}
// Emits the LateParsed property for attributes.
@@ -2061,7 +2059,7 @@ struct PragmaClangAttributeSupport {
return RuleOrAggregateRuleSet(Rules, /*IsRule=*/false);
}
};
- llvm::DenseMap<const Record *, RuleOrAggregateRuleSet> SubjectsToRules;
+ DenseMap<const Record *, RuleOrAggregateRuleSet> SubjectsToRules;
PragmaClangAttributeSupport(const RecordKeeper &Records);
@@ -2301,7 +2299,7 @@ void PragmaClangAttributeSupport::generateParsingHelpers(raw_ostream &OS) {
OS << " return std::nullopt;\n";
OS << "}\n\n";
- llvm::MapVector<const Record *, std::vector<AttributeSubjectMatchRule>>
+ MapVector<const Record *, std::vector<AttributeSubjectMatchRule>>
SubMatchRules;
for (const auto &Rule : Rules) {
if (!Rule.isSubRule())
@@ -2404,7 +2402,7 @@ void generateNameToAttrsMap(const RecordKeeper &Records) {
for (const auto &S : Spellings) {
auto It = NameToAttrsMap.find(S.name());
if (It != NameToAttrsMap.end()) {
- if (llvm::none_of(It->second, [&](const Record *R) { return R == A; }))
+ if (none_of(It->second, [&](const Record *R) { return R == A; }))
It->second.emplace_back(A);
} else {
std::vector<const Record *> V;
@@ -2542,17 +2540,16 @@ static void emitClangAttrArgContextList(const RecordKeeper &Records,
static bool isIdentifierArgument(const Record *Arg) {
return !Arg->getSuperClasses().empty() &&
- llvm::StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
- .Case("IdentifierArgument", true)
- .Case("EnumArgument", true)
- .Case("VariadicEnumArgument", true)
- .Default(false);
+ StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
+ .Case("IdentifierArgument", true)
+ .Case("EnumArgument", true)
+ .Case("VariadicEnumArgument", true)
+ .Default(false);
}
static bool isVariadicIdentifierArgument(const Record *Arg) {
return !Arg->getSuperClasses().empty() &&
- llvm::StringSwitch<bool>(
- Arg->getSuperClasses().back().first->getName())
+ StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
.Case("VariadicIdentifierArgument", true)
.Case("VariadicParamOrParamIdxArgument", true)
.Default(false);
@@ -2560,8 +2557,7 @@ static bool isVariadicIdentifierArgument(const Record *Arg) {
static bool isVariadicExprArgument(const Record *Arg) {
return !Arg->getSuperClasses().empty() &&
- llvm::StringSwitch<bool>(
- Arg->getSuperClasses().back().first->getName())
+ StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
.Case("VariadicExprArgument", true)
.Default(false);
}
@@ -2658,7 +2654,7 @@ static void emitClangAttrStrictIdentifierArgList(const RecordKeeper &Records,
continue;
// Check that there is really an identifier argument.
std::vector<Record *> Args = Attr->getValueAsListOfDefs("Args");
- if (llvm::none_of(Args, [&](Record *R) { return isIdentifierArgument(R); }))
+ if (none_of(Args, [&](Record *R) { return isIdentifierArgument(R); }))
continue;
generateFlattenedSpellingInfo(*Attr, FSIMap);
}
@@ -2668,8 +2664,7 @@ static void emitClangAttrStrictIdentifierArgList(const RecordKeeper &Records,
static bool keywordThisIsaIdentifierInArgument(const Record *Arg) {
return !Arg->getSuperClasses().empty() &&
- llvm::StringSwitch<bool>(
- Arg->getSuperClasses().back().first->getName())
+ StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
.Case("VariadicParamOrParamIdxArgument", true)
.Default(false);
}
@@ -2759,7 +2754,7 @@ static void emitAttributes(const RecordKeeper &Records, raw_ostream &OS,
assert(!Supers.empty() && "Forgot to specify a superclass for the attr");
std::string SuperName;
bool Inheritable = false;
- for (const auto &Super : llvm::reverse(Supers)) {
+ for (const auto &Super : reverse(Supers)) {
const Record *R = Super.first;
if (R->getName() != "TargetSpecificAttr" &&
R->getName() != "DeclOrTypeAttr" && SuperName.empty())
@@ -2843,8 +2838,8 @@ static void emitAttributes(const RecordKeeper &Records, raw_ostream &OS,
if (Header)
OS << SpellingEnum;
- const auto &ParsedAttrSpellingItr = llvm::find_if(
- AttrMap, [R](const std::pair<std::string, const Record *> &P) {
+ const auto &ParsedAttrSpellingItr =
+ find_if(AttrMap, [R](const std::pair<std::string, const Record *> &P) {
return &R == P.second;
});
@@ -3133,7 +3128,7 @@ static void emitAttributes(const RecordKeeper &Records, raw_ostream &OS,
// Emit constructors that takes no arguments if none already exists.
// This is used for delaying arguments.
bool HasRequiredArgs =
- llvm::count_if(Args, [=](const std::unique_ptr<Argument> &arg) {
+ count_if(Args, [=](const std::unique_ptr<Argument> &arg) {
return !arg->isFake() && !arg->isOptional();
});
if (DelayedArgs && HasRequiredArgs)
@@ -3280,7 +3275,7 @@ static void emitAttrList(raw_ostream &OS, StringRef Class,
// Determines if an attribute has a Pragma spelling.
static bool AttrHasPragmaSpelling(const Record *R) {
std::vector<FlattenedSpelling> Spellings = GetFlattenedSpellings(*R);
- return llvm::any_of(Spellings, [](const FlattenedSpelling &S) {
+ return any_of(Spellings, [](const FlattenedSpelling &S) {
return S.variety() == "Pragma";
});
}
@@ -3646,7 +3641,7 @@ static bool GenerateTargetSpecificAttrChecks(const Record *R,
std::string *FnName) {
bool AnyTargetChecks = false;
- // It is assumed that there will be an llvm::Triple object
+ // It is assumed that there will be an Triple object
// named "T" and a TargetInfo object named "Target" within
// scope that can be used to determine whether the attribute exists in
// a given target.
@@ -3756,8 +3751,8 @@ static void GenerateHasAttrSpellingStringSwitch(
}
std::string TestStr = !Test.empty()
- ? Test + " ? " + llvm::itostr(Version) + " : 0"
- : llvm::itostr(Version);
+ ? Test + " ? " + itostr(Version) + " : 0"
+ : itostr(Version);
if (Scope.empty() || Scope == Spelling.nameSpace())
OS << " .Case(\"" << Spelling.name() << "\", " << TestStr << ")\n";
}
@@ -3780,7 +3775,7 @@ void EmitClangRegularKeywordAttributeInfo(const RecordKeeper &Records,
if (!isRegularKeywordAttribute(S))
continue;
std::vector<Record *> Args = R->getValueAsListOfDefs("Args");
- bool HasArgs = llvm::any_of(
+ bool HasArgs = any_of(
Args, [](const Record *Arg) { return !Arg->getValueAsBit("Fake"); });
OS << "KEYWORD_ATTRIBUTE("
@@ -4136,7 +4131,7 @@ static std::string CalculateDiagnostic(const Record &S) {
// The node may contain a list of elements itself, so split the elements
// by a comma, and trim any whitespace.
SmallVector<StringRef, 2> Frags;
- llvm::SplitString(V, Frags, ",");
+ SplitString(V, Frags, ",");
for (auto Str : Frags) {
DiagList.push_back(std::string(Str.trim()));
}
@@ -4164,7 +4159,7 @@ static std::string CalculateDiagnostic(const Record &S) {
// elements with a comma. This leaves the string in the state: foo, bar,
// baz (but misses quux). We can then add ", and " for the last element
// manually.
- std::string Diag = llvm::join(DiagList.begin(), DiagList.end() - 1, ", ");
+ std::string Diag = join(DiagList.begin(), DiagList.end() - 1, ", ");
return '"' + Diag + ", and " + *(DiagList.end() - 1) + '"';
}
@@ -4230,12 +4225,11 @@ static void GenerateAppertainsTo(const Record &Attr, raw_ostream &OS) {
// enough statement attributes with custom subject needs to warrant
// the implementation effort.
std::vector<Record *> DeclSubjects, StmtSubjects;
- llvm::copy_if(
- Subjects, std::back_inserter(DeclSubjects), [](const Record *R) {
- return R->isSubClassOf("SubsetSubject") || !R->isSubClassOf("StmtNode");
- });
- llvm::copy_if(Subjects, std::back_inserter(StmtSubjects),
- [](const Record *R) { return R->isSubClassOf("StmtNode"); });
+ copy_if(Subjects, std::back_inserter(DeclSubjects), [](const Record *R) {
+ return R->isSubClassOf("SubsetSubject") || !R->isSubClassOf("StmtNode");
+ });
+ copy_if(Subjects, std::back_inserter(StmtSubjects),
+ [](const Record *R) { return R->isSubClassOf("StmtNode"); });
// We should have sorted all of the subjects into two lists.
// FIXME: this assertion will be wrong if we ever add type attribute subjects.
@@ -4353,7 +4347,7 @@ static void GenerateMutualExclusionsChecks(const Record &Attr,
auto IsCurAttr = [Attr](const Record *R) {
return R->getName() == Attr.getName();
};
- if (llvm::any_of(MutuallyExclusiveAttrs, IsCurAttr)) {
+ if (any_of(MutuallyExclusiveAttrs, IsCurAttr)) {
// This list of exclusions includes the attribute we're looking for, so
// add the exclusive attributes to the proper list for checking.
for (const Record *AttrToExclude : MutuallyExclusiveAttrs) {
@@ -4565,8 +4559,7 @@ GenerateSpellingTargetRequirements(const Record &Attr,
Test += "((SpellingListIndex == ";
for (unsigned Index = 0; Index < Spellings.size(); ++Index) {
- Test +=
- llvm::itostr(getSpellingListIndex(SpellingList, Spellings[Index]));
+ Test += itostr(getSpellingListIndex(SpellingList, Spellings[Index]));
if (Index != Spellings.size() - 1)
Test += " ||\n SpellingListIndex == ";
else
@@ -4632,8 +4625,7 @@ static void GenerateHandleDeclAttribute(const Record &Attr, raw_ostream &OS) {
static bool isParamExpr(const Record *Arg) {
return !Arg->getSuperClasses().empty() &&
- llvm::StringSwitch<bool>(
- Arg->getSuperClasses().back().first->getName())
+ StringSwitch<bool>(Arg->getSuperClasses().back().first->getName())
.Case("ExprArgument", true)
.Case("VariadicExprArgument", true)
.Default(false);
@@ -4683,9 +4675,8 @@ void GenerateHandleAttrWithDelayedArgs(const RecordKeeper &Records,
static bool IsKnownToGCC(const Record &Attr) {
// Look at the spellings for this subject; if there are any spellings which
// claim to be known to GCC, the attribute is known to GCC.
- return llvm::any_of(
- GetFlattenedSpellings(Attr),
- [](const FlattenedSpelling &S) { return S.knownToGCC(); });
+ return any_of(GetFlattenedSpellings(Attr),
+ [](const FlattenedSpelling &S) { return S.knownToGCC(); });
}
/// Emits the parsed attribute helpers
@@ -4967,7 +4958,7 @@ void EmitClangAttrTextNodeDump(const RecordKeeper &Records, raw_ostream &OS) {
// spelling used for the attribute.
std::string FunctionContent;
- llvm::raw_string_ostream SS(FunctionContent);
+ raw_string_ostream SS(FunctionContent);
std::vector<FlattenedSpelling> Spellings = GetFlattenedSpellings(R);
if (Spellings.size() > 1 && !SpellingNamesAreCommon(Spellings))
@@ -5001,7 +4992,7 @@ void EmitClangAttrNodeTraverse(const RecordKeeper &Records, raw_ostream &OS) {
continue;
std::string FunctionContent;
- llvm::raw_string_ostream SS(FunctionContent);
+ raw_string_ostream SS(FunctionContent);
std::vector<Record *> Args = R.getValueAsListOfDefs("Args");
for (const auto *Arg : Args)
@@ -5173,7 +5164,7 @@ GetAttributeHeadingAndSpellings(const Record &Documentation,
// concatenating all the spellings. Might not be great, but better than
// nothing.
else if (Cat == "Undocumented")
- Heading = llvm::join(Uniques.begin(), Uniques.end(), ", ");
+ Heading = join(Uniques.begin(), Uniques.end(), ", ");
}
}
@@ -5291,10 +5282,10 @@ void EmitClangAttrDocs(const RecordKeeper &Records, raw_ostream &OS) {
for (auto &I : SplitDocs) {
WriteCategoryHeader(I.first, OS);
- llvm::sort(I.second,
- [](const DocumentationData &D1, const DocumentationData &D2) {
- return D1.Heading < D2.Heading;
- });
+ sort(I.second,
+ [](const DocumentationData &D1, const DocumentationData &D2) {
+ return D1.Heading < D2.Heading;
+ });
// Walk over each of the attributes in the category and write out their
// documentation.
@@ -5321,7 +5312,7 @@ void EmitTestPragmaAttributeSupportedAttributes(const RecordKeeper &Records,
SubjectObj->getValueAsListOfDefs("Subjects");
OS << " (";
bool PrintComma = false;
- for (const auto &Subject : llvm::enumerate(Subjects)) {
+ for (const auto &Subject : enumerate(Subjects)) {
if (!isSupportedPragmaClangAttributeSubject(*Subject.value()))
continue;
if (PrintComma)
@@ -5334,7 +5325,7 @@ void EmitTestPragmaAttributeSupportedAttributes(const RecordKeeper &Records,
continue;
}
OS << "(";
- for (const auto &Rule : llvm::enumerate(RuleSet.getAggregateRuleSet())) {
+ for (const auto &Rule : enumerate(RuleSet.getAggregateRuleSet())) {
if (Rule.index())
OS << ", ";
OS << Rule.value().getEnumValueName();
diff --git a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
index 4ae7600a392b8f..20231ee1502c12 100644
--- a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
+++ b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
@@ -133,7 +133,7 @@ class PrototypeParser {
if (!T.consume_front("<"))
PrintFatalError(Loc, "Expected '<' after '_ExtVector'");
unsigned long long Lanes;
- if (llvm::consumeUnsignedInteger(T, 10, Lanes))
+ if (consumeUnsignedInteger(T, 10, Lanes))
PrintFatalError(Loc, "Expected number of lanes after '_ExtVector<'");
Type += "E" + std::to_string(Lanes);
if (!T.consume_front(","))
@@ -187,7 +187,7 @@ class PrototypeParser {
}
public:
- void Print(llvm::raw_ostream &OS) const { OS << ", \"" << Type << '\"'; }
+ void Print(raw_ostream &OS) const { OS << ", \"" << Type << '\"'; }
private:
SMLoc Loc;
@@ -208,14 +208,13 @@ class HeaderNameParser {
}
}
- void Print(llvm::raw_ostream &OS) const { OS << HeaderName; }
+ void Print(raw_ostream &OS) const { OS << HeaderName; }
private:
std::string HeaderName;
};
-void PrintAttributes(const Record *Builtin, BuiltinType BT,
- llvm::raw_ostream &OS) {
+void PrintAttributes(const Record *Builtin, BuiltinType BT, raw_ostream &OS) {
OS << '\"';
if (Builtin->isSubClassOf("LibBuiltin")) {
if (BT == BuiltinType::LibBuiltin) {
@@ -241,7 +240,7 @@ void PrintAttributes(const Record *Builtin, BuiltinType BT,
OS << '\"';
}
-void EmitBuiltinDef(llvm::raw_ostream &OS, StringRef Substitution,
+void EmitBuiltinDef(raw_ostream &OS, StringRef Substitution,
const Record *Builtin, Twine Spelling, BuiltinType BT) {
if (Builtin->getValueAsBit("RequiresUndef"))
OS << "#undef " << Spelling << '\n';
@@ -304,14 +303,14 @@ TemplateInsts getTemplateInsts(const Record *R) {
PrintFatalError(R->getLoc(), "Substitutions and affixes "
"don't have the same lengths");
- for (auto [Affix, Substitution] : llvm::zip(Affixes, Substitutions)) {
+ for (auto [Affix, Substitution] : zip(Affixes, Substitutions)) {
temp.Substitution.emplace_back(Substitution);
temp.Affix.emplace_back(Affix);
}
return temp;
}
-void EmitBuiltin(llvm::raw_ostream &OS, const Record *Builtin) {
+void EmitBuiltin(raw_ostream &OS, const Record *Builtin) {
TemplateInsts Templates = {};
if (Builtin->isSubClassOf("Template")) {
Templates = getTemplateInsts(Builtin);
@@ -321,7 +320,7 @@ void EmitBuiltin(llvm::raw_ostream &OS, const Record *Builtin) {
}
for (auto [Substitution, Affix] :
- llvm::zip(Templates.Substitution, Templates.Affix)) {
+ zip(Templates.Substitution, Templates.Affix)) {
for (StringRef Spelling : Builtin->getValueAsListOfStrings("Spellings")) {
auto FullSpelling =
(Templates.IsPrefix ? Affix + Spelling : Spelling + Affix).str();
@@ -345,8 +344,7 @@ void EmitBuiltin(llvm::raw_ostream &OS, const Record *Builtin) {
}
} // namespace
-void clang::EmitClangBuiltins(const llvm::RecordKeeper &Records,
- llvm::raw_ostream &OS) {
+void clang::EmitClangBuiltins(const RecordKeeper &Records, raw_ostream &OS) {
emitSourceFileHeader("List of builtins that Clang recognizes", OS);
OS << R"c++(
diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
index 773668caa75747..7a8aa181c7588f 100644
--- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -131,12 +131,12 @@ namespace {
};
struct GroupInfo {
- llvm::StringRef GroupName;
+ StringRef GroupName;
std::vector<const Record*> DiagsInGroup;
std::vector<std::string> SubGroups;
unsigned IDNo = 0;
- llvm::SmallVector<const Record *, 1> Defs;
+ SmallVector<const Record *, 1> Defs;
GroupInfo() = default;
};
@@ -213,7 +213,7 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
if (IsImplicit)
continue;
- llvm::SMLoc Loc = Def->getLoc().front();
+ SMLoc Loc = Def->getLoc().front();
if (First) {
SrcMgr.PrintMessage(Loc, SourceMgr::DK_Error,
Twine("group '") + Group.first +
@@ -228,7 +228,7 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
if (!cast<DefInit>(Diag->getValueInit("Group"))->getDef()->isAnonymous())
continue;
- llvm::SMLoc Loc = Diag->getLoc().front();
+ SMLoc Loc = Diag->getLoc().front();
if (First) {
SrcMgr.PrintMessage(Loc, SourceMgr::DK_Error,
Twine("group '") + Group.first +
@@ -247,20 +247,19 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
//===----------------------------------------------------------------------===//
typedef std::vector<const Record *> RecordVec;
-typedef llvm::DenseSet<const Record *> RecordSet;
-typedef llvm::PointerUnion<RecordVec*, RecordSet*> VecOrSet;
+typedef DenseSet<const Record *> RecordSet;
+typedef PointerUnion<RecordVec *, RecordSet *> VecOrSet;
namespace {
class InferPedantic {
- typedef llvm::DenseMap<const Record *,
- std::pair<unsigned, std::optional<unsigned>>>
+ typedef DenseMap<const Record *, std::pair<unsigned, std::optional<unsigned>>>
GMap;
DiagGroupParentMap &DiagGroupParents;
ArrayRef<const Record *> Diags;
const std::vector<const Record *> DiagGroups;
std::map<std::string, GroupInfo> &DiagsInGroup;
- llvm::DenseSet<const Record*> DiagsSet;
+ DenseSet<const Record *> DiagsSet;
GMap GroupCount;
public:
InferPedantic(DiagGroupParentMap &DiagGroupParents,
@@ -277,8 +276,7 @@ class InferPedantic {
private:
/// Determine whether a group is a subgroup of another group.
- bool isSubGroupOfGroup(const Record *Group,
- llvm::StringRef RootGroupName);
+ bool isSubGroupOfGroup(const Record *Group, StringRef RootGroupName);
/// Determine if the diagnostic is an extension.
bool isExtension(const Record *Diag);
@@ -295,8 +293,7 @@ class InferPedantic {
};
} // end anonymous namespace
-bool InferPedantic::isSubGroupOfGroup(const Record *Group,
- llvm::StringRef GName) {
+bool InferPedantic::isSubGroupOfGroup(const Record *Group, StringRef GName) {
const std::string &GroupName =
std::string(Group->getValueAsString("GroupName"));
if (GName == GroupName)
@@ -409,8 +406,8 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
const std::vector<const Record *> &Parents =
DiagGroupParents.getParents(Group);
- bool AllParentsInPedantic = llvm::all_of(
- Parents, [&](const Record *R) { return groupInPedantic(R); });
+ bool AllParentsInPedantic =
+ all_of(Parents, [&](const Record *R) { return groupInPedantic(R); });
// If all the parents are in -Wpedantic, this means that this diagnostic
// group will be indirectly included by -Wpedantic already. In that
// case, do not add it directly to -Wpedantic. If the group has no
@@ -613,11 +610,12 @@ struct DiagnosticTextBuilder {
Piece *getSubstitution(SubstitutionPiece *S) const {
auto It = Substitutions.find(S->Name);
if (It == Substitutions.end())
- PrintFatalError("Failed to find substitution with name: " + S->Name);
+ llvm::PrintFatalError("Failed to find substitution with name: " +
+ S->Name);
return It->second.Root;
}
- [[noreturn]] void PrintFatalError(llvm::Twine const &Msg) const {
+ [[noreturn]] void PrintFatalError(Twine const &Msg) const {
assert(EvaluatingRecord && "not evaluating a record?");
llvm::PrintFatalError(EvaluatingRecord->getLoc(), Msg);
}
@@ -1022,8 +1020,8 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
StopAt Stop) {
std::vector<Piece *> Parsed;
- constexpr llvm::StringLiteral StopSets[] = {"%", "%|}", "%|}$"};
- llvm::StringRef StopSet = StopSets[static_cast<int>(Stop)];
+ constexpr StringLiteral StopSets[] = {"%", "%|}", "%|}$"};
+ StringRef StopSet = StopSets[static_cast<int>(Stop)];
while (!Text.empty()) {
size_t End = (size_t)-2;
@@ -1050,7 +1048,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
size_t ModLength = Text.find_first_of("0123456789{");
StringRef Modifier = Text.slice(0, ModLength);
Text = Text.slice(ModLength, StringRef::npos);
- ModifierType ModType = llvm::StringSwitch<ModifierType>{Modifier}
+ ModifierType ModType = StringSwitch<ModifierType>{Modifier}
.Case("select", MT_Select)
.Case("sub", MT_Sub)
.Case("diff", MT_Diff)
@@ -1227,7 +1225,7 @@ static bool isExemptAtStart(StringRef Text) {
// OBJECT_MODE. However, if there's only a single letter other than "C", we
// do not exempt it so that we catch a case like "A really bad idea" while
// still allowing a case like "C does not allow...".
- if (llvm::all_of(Text, [](char C) {
+ if (all_of(Text, [](char C) {
return isUpper(C) || isDigit(C) || C == '+' || C == '_';
}))
return Text.size() > 1 || Text[0] == 'C';
@@ -1530,11 +1528,11 @@ void clang::EmitClangDiagsDefs(const RecordKeeper &Records, raw_ostream &OS,
// Warning Group Tables generation
//===----------------------------------------------------------------------===//
-static std::string getDiagCategoryEnum(llvm::StringRef name) {
+static std::string getDiagCategoryEnum(StringRef name) {
if (name.empty())
return "DiagCat_None";
- SmallString<256> enumName = llvm::StringRef("DiagCat_");
- for (llvm::StringRef::iterator I = name.begin(), E = name.end(); I != E; ++I)
+ SmallString<256> enumName = StringRef("DiagCat_");
+ for (StringRef::iterator I = name.begin(), E = name.end(); I != E; ++I)
enumName += isalnum(*I) ? *I : '_';
return std::string(enumName);
}
@@ -1841,10 +1839,9 @@ void clang::EmitClangDiagsIndexName(const RecordKeeper &Records,
Index.push_back(RecordIndexElement(R));
}
- llvm::sort(Index,
- [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
- return Lhs.Name < Rhs.Name;
- });
+ sort(Index, [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
+ return Lhs.Name < Rhs.Name;
+ });
for (unsigned i = 0, e = Index.size(); i != e; ++i) {
const RecordIndexElement &R = Index[i];
@@ -1941,7 +1938,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
std::vector<const Record *> DiagGroups =
Records.getAllDerivedDefinitions("DiagGroup");
- llvm::sort(DiagGroups, diagGroupBeforeByName);
+ sort(DiagGroups, diagGroupBeforeByName);
DiagGroupParentMap DGParentMap(Records);
@@ -1960,8 +1957,8 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
DiagsInPedanticSet.end());
RecordVec GroupsInPedantic(GroupsInPedanticSet.begin(),
GroupsInPedanticSet.end());
- llvm::sort(DiagsInPedantic, beforeThanCompare);
- llvm::sort(GroupsInPedantic, beforeThanCompare);
+ sort(DiagsInPedantic, beforeThanCompare);
+ sort(GroupsInPedantic, beforeThanCompare);
PedDiags.DiagsInGroup.insert(PedDiags.DiagsInGroup.end(),
DiagsInPedantic.begin(),
DiagsInPedantic.end());
@@ -2012,7 +2009,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
OS << "Also controls ";
bool First = true;
- llvm::sort(GroupInfo.SubGroups);
+ sort(GroupInfo.SubGroups);
for (const auto &Name : GroupInfo.SubGroups) {
if (!First) OS << ", ";
OS << "`" << (IsRemarkGroup ? "-R" : "-W") << Name << "`_";
diff --git a/clang/utils/TableGen/ClangOpcodesEmitter.cpp b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
index 7e426d59359a87..a18220fe23c417 100644
--- a/clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -57,7 +57,7 @@ class ClangOpcodesEmitter {
void Enumerate(const Record *R, StringRef N,
std::function<void(ArrayRef<const Record *>, Twine)> &&F) {
- llvm::SmallVector<const Record *, 2> TypePath;
+ SmallVector<const Record *, 2> TypePath;
const auto *Types = R->getValueAsListInit("Types");
std::function<void(size_t, const Twine &)> Rec;
@@ -304,7 +304,7 @@ void ClangOpcodesEmitter::EmitGroup(raw_ostream &OS, StringRef N,
OS << "const SourceInfo &I) {\n";
std::function<void(size_t, const Twine &)> Rec;
- llvm::SmallVector<const Record *, 2> TS;
+ SmallVector<const Record *, 2> TS;
Rec = [this, &Rec, &OS, Types, &Args, R, &TS, N,
EmitFuncName](size_t I, const Twine &ID) {
if (I >= Types->size()) {
diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index d68dcc472a7bdb..cbbd825b3b4fff 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -515,8 +515,7 @@ void BuiltinNameEmitter::GetOverloads() {
auto Signature = B->getValueAsListOfDefs("Signature");
// Reuse signatures to avoid unnecessary duplicates.
- auto it =
- llvm::find_if(SignaturesList,
+ auto it = find_if(SignaturesList,
[&](const std::pair<std::vector<Record *>, unsigned> &a) {
return a.first == Signature;
});
@@ -688,7 +687,7 @@ void BuiltinNameEmitter::GroupBySignature() {
CurSignatureList->push_back(Signature.second);
}
// Sort the list to facilitate future comparisons.
- llvm::sort(*CurSignatureList);
+ sort(*CurSignatureList);
// Check if we have already seen another function with the same list of
// signatures. If so, just add the name of the function.
@@ -1278,7 +1277,7 @@ void OpenCLBuiltinHeaderEmitter::emit() {
// Iterate over all builtins; sort to follow order of definition in .td file.
std::vector<const Record *> Builtins =
Records.getAllDerivedDefinitions("Builtin");
- llvm::sort(Builtins, LessRecord());
+ sort(Builtins, LessRecord());
for (const auto *B : Builtins) {
StringRef Name = B->getValueAsString("Name");
diff --git a/clang/utils/TableGen/ClangOptionDocEmitter.cpp b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
index 8c32f0218e761b..d8a467fd41a2ef 100644
--- a/clang/utils/TableGen/ClangOptionDocEmitter.cpp
+++ b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -136,7 +136,7 @@ Documentation extractDocumentation(const RecordKeeper &Records,
auto DocumentationForOption = [&](const Record *R) -> DocumentedOption {
auto &A = Aliases[R];
- llvm::sort(A, CompareByName);
+ sort(A, CompareByName);
return {R, std::move(A)};
};
@@ -145,7 +145,7 @@ Documentation extractDocumentation(const RecordKeeper &Records,
Documentation D;
auto &Groups = GroupsInGroup[R];
- llvm::sort(Groups, CompareByLocation);
+ sort(Groups, CompareByLocation);
for (const Record *G : Groups) {
D.Groups.emplace_back();
D.Groups.back().Group = G;
@@ -156,7 +156,7 @@ Documentation extractDocumentation(const RecordKeeper &Records,
}
auto &Options = OptionsInGroup[R];
- llvm::sort(Options, CompareByName);
+ sort(Options, CompareByName);
for (const Record *O : Options)
if (isOptionVisible(O, DocInfo))
D.Options.push_back(DocumentationForOption(O));
diff --git a/clang/utils/TableGen/ClangSACheckersEmitter.cpp b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
index 44c2d8b31655d2..998c5ed2079d71 100644
--- a/clang/utils/TableGen/ClangSACheckersEmitter.cpp
+++ b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
@@ -85,7 +85,7 @@ static std::string getCheckerDocs(const Record &R) {
return "";
std::string CheckerFullName = StringRef(getCheckerFullName(&R, "-")).lower();
- return (llvm::Twine("https://clang.llvm.org/docs/analyzer/checkers.html#") +
+ return (Twine("https://clang.llvm.org/docs/analyzer/checkers.html#") +
CheckerFullName)
.str();
}
@@ -137,7 +137,7 @@ static bool isHidden(const Record *R) {
return false;
}
-static void printChecker(llvm::raw_ostream &OS, const Record &R) {
+static void printChecker(raw_ostream &OS, const Record &R) {
OS << "CHECKER(" << "\"";
OS.write_escaped(getCheckerFullName(&R)) << "\", ";
OS << R.getName() << ", ";
@@ -155,8 +155,7 @@ static void printChecker(llvm::raw_ostream &OS, const Record &R) {
OS << ")\n";
}
-static void printOption(llvm::raw_ostream &OS, StringRef FullName,
- const Record &R) {
+static void printOption(raw_ostream &OS, StringRef FullName, const Record &R) {
OS << "\"";
OS.write_escaped(getCheckerOptionType(R)) << "\", \"";
OS.write_escaped(FullName) << "\", ";
@@ -180,7 +179,7 @@ void clang::EmitClangSACheckers(const RecordKeeper &Records, raw_ostream &OS) {
ArrayRef<const Record *> packages =
Records.getAllDerivedDefinitions("Package");
- using SortedRecords = llvm::StringMap<const Record *>;
+ using SortedRecords = StringMap<const Record *>;
OS << "// This file is automatically generated. Do not edit this file by "
"hand.\n";
diff --git a/clang/utils/TableGen/ClangSyntaxEmitter.cpp b/clang/utils/TableGen/ClangSyntaxEmitter.cpp
index 66b27be88f56f5..3457e5bd283706 100644
--- a/clang/utils/TableGen/ClangSyntaxEmitter.cpp
+++ b/clang/utils/TableGen/ClangSyntaxEmitter.cpp
@@ -33,23 +33,23 @@
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
+using namespace llvm;
+
namespace {
-using llvm::formatv;
// The class hierarchy of Node types.
// We assemble this in order to be able to define the NodeKind enum in a
// stable and useful way, where abstract Node subclasses correspond to ranges.
class Hierarchy {
public:
- Hierarchy(const llvm::RecordKeeper &Records) {
- for (const llvm::Record *T : Records.getAllDerivedDefinitions("NodeType"))
+ Hierarchy(const RecordKeeper &Records) {
+ for (const Record *T : Records.getAllDerivedDefinitions("NodeType"))
add(T);
- for (const llvm::Record *Derived :
- Records.getAllDerivedDefinitions("NodeType"))
- if (const llvm::Record *Base = Derived->getValueAsOptionalDef("base"))
+ for (const Record *Derived : Records.getAllDerivedDefinitions("NodeType"))
+ if (const Record *Base = Derived->getValueAsOptionalDef("base"))
link(Derived, Base);
for (NodeType &N : AllTypes) {
- llvm::sort(N.Derived, [](const NodeType *L, const NodeType *R) {
+ sort(N.Derived, [](const NodeType *L, const NodeType *R) {
return L->Record->getName() < R->Record->getName();
});
// Alternatives nodes must have subclasses, External nodes may do.
@@ -60,20 +60,20 @@ class Hierarchy {
}
struct NodeType {
- const llvm::Record *Record = nullptr;
+ const Record *Record = nullptr;
const NodeType *Base = nullptr;
std::vector<const NodeType *> Derived;
- llvm::StringRef name() const { return Record->getName(); }
+ StringRef name() const { return Record->getName(); }
};
- NodeType &get(llvm::StringRef Name = "Node") {
+ NodeType &get(StringRef Name = "Node") {
auto NI = ByName.find(Name);
assert(NI != ByName.end() && "no such node");
return *NI->second;
}
// Traverse the hierarchy in pre-order (base classes before derived).
- void visit(llvm::function_ref<void(const NodeType &)> CB,
+ void visit(function_ref<void(const NodeType &)> CB,
const NodeType *Start = nullptr) {
if (Start == nullptr)
Start = &get();
@@ -83,7 +83,7 @@ class Hierarchy {
}
private:
- void add(const llvm::Record *R) {
+ void add(const Record *R) {
AllTypes.emplace_back();
AllTypes.back().Record = R;
bool Inserted = ByName.try_emplace(R->getName(), &AllTypes.back()).second;
@@ -91,7 +91,7 @@ class Hierarchy {
(void)Inserted;
}
- void link(const llvm::Record *Derived, const llvm::Record *Base) {
+ void link(const Record *Derived, const Record *Base) {
auto &CN = get(Derived->getName()), &PN = get(Base->getName());
assert(CN.Base == nullptr && "setting base twice");
PN.Derived.push_back(&CN);
@@ -99,7 +99,7 @@ class Hierarchy {
}
std::deque<NodeType> AllTypes;
- llvm::DenseMap<llvm::StringRef, NodeType *> ByName;
+ DenseMap<StringRef, NodeType *> ByName;
};
const Hierarchy::NodeType &firstConcrete(const Hierarchy::NodeType &N) {
@@ -110,7 +110,7 @@ const Hierarchy::NodeType &lastConcrete(const Hierarchy::NodeType &N) {
}
struct SyntaxConstraint {
- SyntaxConstraint(const llvm::Record &R) {
+ SyntaxConstraint(const Record &R) {
if (R.isSubClassOf("Optional")) {
*this = SyntaxConstraint(*R.getValueAsDef("inner"));
} else if (R.isSubClassOf("AnyToken")) {
@@ -128,9 +128,9 @@ struct SyntaxConstraint {
} // namespace
-void clang::EmitClangSyntaxNodeList(const llvm::RecordKeeper &Records,
- llvm::raw_ostream &OS) {
- llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
+void clang::EmitClangSyntaxNodeList(const RecordKeeper &Records,
+ raw_ostream &OS) {
+ emitSourceFileHeader("Syntax tree node list", OS, Records);
Hierarchy H(Records);
OS << R"cpp(
#ifndef NODE
@@ -175,21 +175,21 @@ void clang::EmitClangSyntaxNodeList(const llvm::RecordKeeper &Records,
// /// widget.explode()
// Leading and trailing whitespace lines are stripped.
// The indentation of the first line is stripped from all lines.
-static void printDoc(llvm::StringRef Doc, llvm::raw_ostream &OS) {
+static void printDoc(StringRef Doc, raw_ostream &OS) {
Doc = Doc.rtrim();
- llvm::StringRef Line;
+ StringRef Line;
while (Line.trim().empty() && !Doc.empty())
std::tie(Line, Doc) = Doc.split('\n');
- llvm::StringRef Indent = Line.take_while(llvm::isSpace);
+ StringRef Indent = Line.take_while(isSpace);
for (; !Line.empty() || !Doc.empty(); std::tie(Line, Doc) = Doc.split('\n')) {
Line.consume_front(Indent);
OS << "/// " << Line << "\n";
}
}
-void clang::EmitClangSyntaxNodeClasses(const llvm::RecordKeeper &Records,
- llvm::raw_ostream &OS) {
- llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
+void clang::EmitClangSyntaxNodeClasses(const RecordKeeper &Records,
+ raw_ostream &OS) {
+ emitSourceFileHeader("Syntax tree node list", OS, Records);
Hierarchy H(Records);
OS << "\n// Forward-declare node types so we don't have to carefully "
@@ -218,7 +218,7 @@ void clang::EmitClangSyntaxNodeClasses(const llvm::RecordKeeper &Records,
// Getters for sequence elements.
for (const auto &C : N.Record->getValueAsListOfDefs("children")) {
assert(C->isSubClassOf("Role"));
- llvm::StringRef Role = C->getValueAsString("role");
+ StringRef Role = C->getValueAsString("role");
SyntaxConstraint Constraint(*C->getValueAsDef("syntax"));
for (const char *Const : {"", "const "})
OS << formatv(
diff --git a/clang/utils/TableGen/MveEmitter.cpp b/clang/utils/TableGen/MveEmitter.cpp
index 6cfaa891241fa9..88b89d29695353 100644
--- a/clang/utils/TableGen/MveEmitter.cpp
+++ b/clang/utils/TableGen/MveEmitter.cpp
@@ -893,8 +893,8 @@ class ACLEIntrinsic {
}
bool hasCode() const { return Code != nullptr; }
- static std::string signedHexLiteral(const llvm::APInt &iOrig) {
- llvm::APInt i = iOrig.trunc(64);
+ static std::string signedHexLiteral(const APInt &iOrig) {
+ APInt i = iOrig.trunc(64);
SmallString<40> s;
i.toString(s, 16, true, true);
return std::string(s);
@@ -907,7 +907,7 @@ class ACLEIntrinsic {
for (const auto &kv : ImmediateArgs) {
const ImmediateArg &IA = kv.second;
- llvm::APInt lo(128, 0), hi(128, 0);
+ APInt lo(128, 0), hi(128, 0);
switch (IA.boundsType) {
case ImmediateArg::BoundsType::ExplicitRange:
lo = IA.i1;
@@ -915,7 +915,7 @@ class ACLEIntrinsic {
break;
case ImmediateArg::BoundsType::UInt:
lo = 0;
- hi = llvm::APInt::getMaxValue(IA.i1).zext(128);
+ hi = APInt::getMaxValue(IA.i1).zext(128);
break;
}
@@ -925,8 +925,8 @@ class ACLEIntrinsic {
// immediate is smaller than the _possible_ range of values for
// its type.
unsigned ArgTypeBits = IA.ArgType->sizeInBits();
- llvm::APInt ArgTypeRange = llvm::APInt::getMaxValue(ArgTypeBits).zext(128);
- llvm::APInt ActualRange = (hi-lo).trunc(64).sext(128);
+ APInt ArgTypeRange = APInt::getMaxValue(ArgTypeBits).zext(128);
+ APInt ActualRange = (hi - lo).trunc(64).sext(128);
if (ActualRange.ult(ArgTypeRange))
SemaChecks.push_back("SemaRef.BuiltinConstantArgRange(TheCall, " +
Index + ", " + signedHexLiteral(lo) + ", " +
diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp
index 9e5480be20adac..050c7b341ccd1c 100644
--- a/clang/utils/TableGen/NeonEmitter.cpp
+++ b/clang/utils/TableGen/NeonEmitter.cpp
@@ -434,11 +434,11 @@ class Intrinsic {
ImmChecks.emplace_back(ArgIdx, Kind, EltSizeInBits, VecSizeInBits);
}
- llvm::sort(ImmChecks.begin(), ImmChecks.end(),
- [](const ImmCheck &a, const ImmCheck &b) {
- return a.getImmArgIdx() < b.getImmArgIdx();
- }); // Sort for comparison with other intrinsics which map to the
- // same builtin
+ sort(ImmChecks.begin(), ImmChecks.end(),
+ [](const ImmCheck &a, const ImmCheck &b) {
+ return a.getImmArgIdx() < b.getImmArgIdx();
+ }); // Sort for comparison with other intrinsics which map to the
+ // same builtin
}
/// Get the Record that this intrinsic is based off.
@@ -456,7 +456,7 @@ class Intrinsic {
/// Return true if the intrinsic takes an immediate operand.
bool hasImmediate() const {
- return llvm::any_of(Types, [](const Type &T) { return T.isImmediate(); });
+ return any_of(Types, [](const Type &T) { return T.isImmediate(); });
}
// Return if the supplied argument is an immediate
@@ -1320,8 +1320,8 @@ void Intrinsic::emitShadowedArgs() {
}
bool Intrinsic::protoHasScalar() const {
- return llvm::any_of(
- Types, [](const Type &T) { return T.isScalar() && !T.isImmediate(); });
+ return any_of(Types,
+ [](const Type &T) { return T.isScalar() && !T.isImmediate(); });
}
void Intrinsic::emitBodyAsBuiltinCall() {
@@ -1964,7 +1964,7 @@ Intrinsic &NeonEmitter::getIntrinsic(StringRef Name, ArrayRef<Type> Types,
continue;
unsigned ArgNum = 0;
- bool MatchingArgumentTypes = llvm::all_of(Types, [&](const auto &Type) {
+ bool MatchingArgumentTypes = all_of(Types, [&](const auto &Type) {
return Type == I.getParamType(ArgNum++);
});
@@ -2022,7 +2022,7 @@ void NeonEmitter::createIntrinsic(const Record *R,
}
}
- llvm::sort(NewTypeSpecs);
+ sort(NewTypeSpecs);
NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()),
NewTypeSpecs.end());
auto &Entry = IntrinsicMap[Name];
@@ -2406,7 +2406,7 @@ void NeonEmitter::run(raw_ostream &OS) {
for (auto *I : Defs)
I->indexBody();
- llvm::stable_sort(Defs, llvm::deref<std::less<>>());
+ stable_sort(Defs, deref<std::less<>>());
// Only emit a def when its requirements have been met.
// FIXME: This loop could be made faster, but it's fast enough for now.
@@ -2419,7 +2419,7 @@ void NeonEmitter::run(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
- if (llvm::is_contained(Defs, II))
+ if (is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
@@ -2513,7 +2513,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
for (auto *I : Defs)
I->indexBody();
- llvm::stable_sort(Defs, llvm::deref<std::less<>>());
+ stable_sort(Defs, deref<std::less<>>());
// Only emit a def when its requirements have been met.
// FIXME: This loop could be made faster, but it's fast enough for now.
@@ -2526,7 +2526,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
- if (llvm::is_contained(Defs, II))
+ if (is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
@@ -2621,7 +2621,7 @@ void NeonEmitter::runBF16(raw_ostream &OS) {
for (auto *I : Defs)
I->indexBody();
- llvm::stable_sort(Defs, llvm::deref<std::less<>>());
+ stable_sort(Defs, deref<std::less<>>());
// Only emit a def when its requirements have been met.
// FIXME: This loop could be made faster, but it's fast enough for now.
@@ -2634,7 +2634,7 @@ void NeonEmitter::runBF16(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
- if (llvm::is_contained(Defs, II))
+ if (is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index 4ef83e7b608dc0..de03aadefdd11c 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -502,8 +502,8 @@ void RVVEmitter::createCodeGen(raw_ostream &OS) {
std::vector<std::unique_ptr<RVVIntrinsic>> Defs;
createRVVIntrinsics(Defs);
// IR name could be empty, use the stable sort preserves the relative order.
- llvm::stable_sort(Defs, [](const std::unique_ptr<RVVIntrinsic> &A,
- const std::unique_ptr<RVVIntrinsic> &B) {
+ stable_sort(Defs, [](const std::unique_ptr<RVVIntrinsic> &A,
+ const std::unique_ptr<RVVIntrinsic> &B) {
if (A->getIRName() == B->getIRName())
return (A->getPolicyAttrs() < B->getPolicyAttrs());
return (A->getIRName() < B->getIRName());
@@ -606,7 +606,7 @@ void RVVEmitter::createRVVIntrinsics(
BasicPrototype, /*IsMasked=*/false,
/*HasMaskedOffOperand=*/false, HasVL, NF, UnMaskedPolicyScheme,
DefaultPolicy, IsTuple);
- llvm::SmallVector<PrototypeDescriptor> MaskedPrototype;
+ SmallVector<PrototypeDescriptor> MaskedPrototype;
if (HasMasked)
MaskedPrototype = RVVIntrinsic::computeBuiltinTypes(
BasicPrototype, /*IsMasked=*/true, HasMaskedOffOperand, HasVL, NF,
diff --git a/clang/utils/TableGen/SveEmitter.cpp b/clang/utils/TableGen/SveEmitter.cpp
index 5abf6fc49bc30b..2f9747e7de3de2 100644
--- a/clang/utils/TableGen/SveEmitter.cpp
+++ b/clang/utils/TableGen/SveEmitter.cpp
@@ -206,7 +206,7 @@ class Intrinsic {
ArrayRef<SVEType> getTypes() const { return Types; }
SVEType getParamType(unsigned I) const { return Types[I + 1]; }
unsigned getNumParams() const {
- return Proto.size() - (2 * llvm::count(Proto, '.')) - 1;
+ return Proto.size() - (2 * count(Proto, '.')) - 1;
}
uint64_t getFlags() const { return Flags; }
@@ -281,11 +281,11 @@ class SVEEmitter {
static const std::array<ReinterpretTypeInfo, 12> Reinterprets;
const RecordKeeper &Records;
- llvm::StringMap<uint64_t> EltTypes;
- llvm::StringMap<uint64_t> MemEltTypes;
- llvm::StringMap<uint64_t> FlagTypes;
- llvm::StringMap<uint64_t> MergeTypes;
- llvm::StringMap<uint64_t> ImmCheckTypes;
+ StringMap<uint64_t> EltTypes;
+ StringMap<uint64_t> MemEltTypes;
+ StringMap<uint64_t> FlagTypes;
+ StringMap<uint64_t> MergeTypes;
+ StringMap<uint64_t> ImmCheckTypes;
public:
SVEEmitter(const RecordKeeper &R) : Records(R) {
@@ -322,7 +322,7 @@ class SVEEmitter {
auto It = FlagTypes.find(MaskName);
if (It != FlagTypes.end()) {
uint64_t Mask = It->getValue();
- unsigned Shift = llvm::countr_zero(Mask);
+ unsigned Shift = countr_zero(Mask);
assert(Shift < 64 && "Mask value produced an invalid shift value");
return (V << Shift) & Mask;
}
@@ -1187,7 +1187,7 @@ void SVEEmitter::createIntrinsic(
}
// Remove duplicate type specs.
- llvm::sort(TypeSpecs);
+ sort(TypeSpecs);
TypeSpecs.erase(std::unique(TypeSpecs.begin(), TypeSpecs.end()),
TypeSpecs.end());
@@ -1433,8 +1433,8 @@ void SVEEmitter::createBuiltins(raw_ostream &OS) {
createIntrinsic(R, Defs);
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
@@ -1475,8 +1475,8 @@ void SVEEmitter::createCodeGenMap(raw_ostream &OS) {
createIntrinsic(R, Defs);
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
@@ -1508,12 +1508,11 @@ void SVEEmitter::createRangeChecks(raw_ostream &OS) {
createIntrinsic(R, Defs);
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
-
OS << "#ifdef GET_SVE_IMMEDIATE_CHECK\n";
// Ensure these are only emitted once.
@@ -1641,8 +1640,8 @@ void SVEEmitter::createSMEBuiltins(raw_ostream &OS) {
}
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
@@ -1669,8 +1668,8 @@ void SVEEmitter::createSMECodeGenMap(raw_ostream &OS) {
}
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
@@ -1703,12 +1702,11 @@ void SVEEmitter::createSMERangeChecks(raw_ostream &OS) {
}
// The mappings must be sorted based on BuiltinID.
- llvm::sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
- const std::unique_ptr<Intrinsic> &B) {
+ sort(Defs, [](const std::unique_ptr<Intrinsic> &A,
+ const std::unique_ptr<Intrinsic> &B) {
return A->getMangledName() < B->getMangledName();
});
-
OS << "#ifdef GET_SME_IMMEDIATE_CHECK\n";
// Ensure these are only emitted once.
@@ -1790,7 +1788,7 @@ void SVEEmitter::createStreamingAttrs(raw_ostream &OS, ACLEKind Kind) {
OS << "#ifdef GET_" << ExtensionKind << "_STREAMING_ATTRS\n";
- llvm::StringMap<std::set<std::string>> StreamingMap;
+ StringMap<std::set<std::string>> StreamingMap;
uint64_t IsStreamingFlag = getEnumValueForFlag("IsStreaming");
uint64_t VerifyRuntimeMode = getEnumValueForFlag("VerifyRuntimeMode");
More information about the cfe-commits
mailing list