aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:49 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:49 +0000
commit2298981669bf3bd63335a4be179bc0f96823a8f4 (patch)
tree1cbe2eb27f030d2d70b80ee5ca3c86bee7326a9f /utils
parent9a83721404652cea39e9f02ae3e3b5c964602a5c (diff)
downloadsrc-2298981669bf3bd63335a4be179bc0f96823a8f4.tar.gz
src-2298981669bf3bd63335a4be179bc0f96823a8f4.zip
Vendor import of stripped clang trunk r366426 (just before thevendor/clang/clang-trunk-r366426
Notes
Notes: svn path=/vendor/clang/dist/; revision=351280 svn path=/vendor/clang/clang-trunk-r366426/; revision=351281; tag=vendor/clang/clang-trunk-r366426
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/ClangASTNodesEmitter.cpp7
-rw-r--r--utils/TableGen/ClangAttrEmitter.cpp153
-rw-r--r--utils/TableGen/ClangCommentCommandInfoEmitter.cpp7
-rw-r--r--utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp7
-rw-r--r--utils/TableGen/ClangCommentHTMLTagsEmitter.cpp7
-rw-r--r--utils/TableGen/ClangDiagnosticsEmitter.cpp7
-rw-r--r--utils/TableGen/ClangOpenCLBuiltinEmitter.cpp318
-rw-r--r--utils/TableGen/ClangOptionDocEmitter.cpp7
-rw-r--r--utils/TableGen/ClangSACheckersEmitter.cpp223
-rw-r--r--utils/TableGen/NeonEmitter.cpp19
-rw-r--r--utils/TableGen/TableGen.cpp13
-rw-r--r--utils/TableGen/TableGenBackends.h68
12 files changed, 700 insertions, 136 deletions
diff --git a/utils/TableGen/ClangASTNodesEmitter.cpp b/utils/TableGen/ClangASTNodesEmitter.cpp
index b132dcbead5c..a0bbdbab3354 100644
--- a/utils/TableGen/ClangASTNodesEmitter.cpp
+++ b/utils/TableGen/ClangASTNodesEmitter.cpp
@@ -1,9 +1,8 @@
//=== ClangASTNodesEmitter.cpp - Generate Clang AST node tables -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp
index 874ad2df0031..f315262ad0f4 100644
--- a/utils/TableGen/ClangAttrEmitter.cpp
+++ b/utils/TableGen/ClangAttrEmitter.cpp
@@ -1,9 +1,8 @@
//===- ClangAttrEmitter.cpp - Generate Clang attribute handling =-*- C++ -*--=//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -611,7 +610,7 @@ namespace {
void writeDumpChildren(raw_ostream &OS) const override {
OS << " if (SA->is" << getUpperName() << "Expr())\n";
- OS << " dumpStmt(SA->get" << getUpperName() << "Expr());\n";
+ OS << " Visit(SA->get" << getUpperName() << "Expr());\n";
}
void writeHasChildren(raw_ostream &OS) const override {
@@ -776,6 +775,11 @@ namespace {
}
};
+ struct VariadicParamOrParamIdxArgument : public VariadicArgument {
+ VariadicParamOrParamIdxArgument(const Record &Arg, StringRef Attr)
+ : VariadicArgument(Arg, Attr, "int") {}
+ };
+
// Unique the enums, but maintain the original declaration ordering.
std::vector<StringRef>
uniqueEnumsInOrder(const std::vector<StringRef> &enums) {
@@ -1109,7 +1113,7 @@ namespace {
void writeDump(raw_ostream &OS) const override {}
void writeDumpChildren(raw_ostream &OS) const override {
- OS << " dumpStmt(SA->get" << getUpperName() << "());\n";
+ OS << " Visit(SA->get" << getUpperName() << "());\n";
}
void writeHasChildren(raw_ostream &OS) const override { OS << "true"; }
@@ -1165,7 +1169,7 @@ namespace {
OS << " for (" << getAttrName() << "Attr::" << getLowerName()
<< "_iterator I = SA->" << getLowerName() << "_begin(), E = SA->"
<< getLowerName() << "_end(); I != E; ++I)\n";
- OS << " dumpStmt(*I);\n";
+ OS << " Visit(*I);\n";
}
void writeHasChildren(raw_ostream &OS) const override {
@@ -1284,6 +1288,8 @@ createArgument(const Record &Arg, StringRef Attr,
Ptr = llvm::make_unique<VariadicExprArgument>(Arg, Attr);
else if (ArgName == "VariadicParamIdxArgument")
Ptr = llvm::make_unique<VariadicParamIdxArgument>(Arg, Attr);
+ else if (ArgName == "VariadicParamOrParamIdxArgument")
+ Ptr = llvm::make_unique<VariadicParamOrParamIdxArgument>(Arg, Attr);
else if (ArgName == "ParamIdxArgument")
Ptr = llvm::make_unique<SimpleArgument>(Arg, Attr, "ParamIdx");
else if (ArgName == "VariadicIdentifierArgument")
@@ -1916,6 +1922,30 @@ bool PragmaClangAttributeSupport::isAttributedSupported(
return true;
}
+static std::string GenerateTestExpression(ArrayRef<Record *> LangOpts) {
+ std::string Test;
+
+ for (auto *E : LangOpts) {
+ if (!Test.empty())
+ Test += " || ";
+
+ const StringRef Code = E->getValueAsString("CustomCode");
+ if (!Code.empty()) {
+ Test += "(";
+ Test += Code;
+ Test += ")";
+ } else {
+ Test += "LangOpts.";
+ Test += E->getValueAsString("Name");
+ }
+ }
+
+ if (Test.empty())
+ return "true";
+
+ return Test;
+}
+
std::string
PragmaClangAttributeSupport::generateStrictConformsTo(const Record &Attr,
raw_ostream &OS) {
@@ -1942,19 +1972,8 @@ PragmaClangAttributeSupport::generateStrictConformsTo(const Record &Attr,
// rules if the specific language options are specified.
std::vector<Record *> LangOpts = Rule.getLangOpts();
OS << " MatchRules.push_back(std::make_pair(" << Rule.getEnumValue()
- << ", /*IsSupported=*/";
- if (!LangOpts.empty()) {
- for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I) {
- const StringRef Part = (*I)->getValueAsString("Name");
- if ((*I)->getValueAsBit("Negated"))
- OS << "!";
- OS << "LangOpts." << Part;
- if (I + 1 != E)
- OS << " || ";
- }
- } else
- OS << "true";
- OS << "));\n";
+ << ", /*IsSupported=*/" << GenerateTestExpression(LangOpts)
+ << "));\n";
}
}
OS << "}\n\n";
@@ -2117,6 +2136,7 @@ static bool isVariadicIdentifierArgument(Record *Arg) {
llvm::StringSwitch<bool>(
Arg->getSuperClasses().back().first->getName())
.Case("VariadicIdentifierArgument", true)
+ .Case("VariadicParamOrParamIdxArgument", true)
.Default(false);
}
@@ -2159,6 +2179,34 @@ static void emitClangAttrIdentifierArgList(RecordKeeper &Records, raw_ostream &O
OS << "#endif // CLANG_ATTR_IDENTIFIER_ARG_LIST\n\n";
}
+static bool keywordThisIsaIdentifierInArgument(const Record *Arg) {
+ return !Arg->getSuperClasses().empty() &&
+ llvm::StringSwitch<bool>(
+ Arg->getSuperClasses().back().first->getName())
+ .Case("VariadicParamOrParamIdxArgument", true)
+ .Default(false);
+}
+
+static void emitClangAttrThisIsaIdentifierArgList(RecordKeeper &Records,
+ raw_ostream &OS) {
+ OS << "#if defined(CLANG_ATTR_THIS_ISA_IDENTIFIER_ARG_LIST)\n";
+ std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
+ for (const auto *A : Attrs) {
+ // Determine whether the first argument is a variadic identifier.
+ std::vector<Record *> Args = A->getValueAsListOfDefs("Args");
+ if (Args.empty() || !keywordThisIsaIdentifierInArgument(Args[0]))
+ continue;
+
+ // All these spellings take an identifier argument.
+ forEachUniqueSpelling(*A, [&](const FlattenedSpelling &S) {
+ OS << ".Case(\"" << S.name() << "\", "
+ << "true"
+ << ")\n";
+ });
+ }
+ OS << "#endif // CLANG_ATTR_THIS_ISA_IDENTIFIER_ARG_LIST\n\n";
+}
+
namespace clang {
// Emits the class definitions for attributes.
@@ -2762,7 +2810,7 @@ void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
// Helper function for GenerateTargetSpecificAttrChecks that alters the 'Test'
// parameter with only a single check type, if applicable.
-static void GenerateTargetSpecificAttrCheck(const Record *R, std::string &Test,
+static bool GenerateTargetSpecificAttrCheck(const Record *R, std::string &Test,
std::string *FnName,
StringRef ListName,
StringRef CheckAgainst,
@@ -2782,7 +2830,9 @@ static void GenerateTargetSpecificAttrCheck(const Record *R, std::string &Test,
*FnName += Part;
}
Test += ")";
+ return true;
}
+ return false;
}
// Generate a conditional expression to check if the current target satisfies
@@ -2790,10 +2840,12 @@ static void GenerateTargetSpecificAttrCheck(const Record *R, std::string &Test,
// those checks to the Test string. If the FnName string pointer is non-null,
// append a unique suffix to distinguish this set of target checks from other
// TargetSpecificAttr records.
-static void GenerateTargetSpecificAttrChecks(const Record *R,
+static bool GenerateTargetSpecificAttrChecks(const Record *R,
std::vector<StringRef> &Arches,
std::string &Test,
std::string *FnName) {
+ bool AnyTargetChecks = false;
+
// It is assumed that there will be an llvm::Triple object
// named "T" and a TargetInfo object named "Target" within
// scope that can be used to determine whether the attribute exists in
@@ -2803,6 +2855,7 @@ static void GenerateTargetSpecificAttrChecks(const Record *R,
// differently because GenerateTargetRequirements needs to combine the list
// with ParseKind.
if (!Arches.empty()) {
+ AnyTargetChecks = true;
Test += " && (";
for (auto I = Arches.begin(), E = Arches.end(); I != E; ++I) {
StringRef Part = *I;
@@ -2817,16 +2870,24 @@ static void GenerateTargetSpecificAttrChecks(const Record *R,
}
// If the attribute is specific to particular OSes, check those.
- GenerateTargetSpecificAttrCheck(R, Test, FnName, "OSes", "T.getOS()",
- "llvm::Triple::");
+ AnyTargetChecks |= GenerateTargetSpecificAttrCheck(
+ R, Test, FnName, "OSes", "T.getOS()", "llvm::Triple::");
- // If one or more CXX ABIs are specified, check those as well.
- GenerateTargetSpecificAttrCheck(R, Test, FnName, "CXXABIs",
- "Target.getCXXABI().getKind()",
- "TargetCXXABI::");
// If one or more object formats is specified, check those.
- GenerateTargetSpecificAttrCheck(R, Test, FnName, "ObjectFormats",
- "T.getObjectFormat()", "llvm::Triple::");
+ AnyTargetChecks |=
+ GenerateTargetSpecificAttrCheck(R, Test, FnName, "ObjectFormats",
+ "T.getObjectFormat()", "llvm::Triple::");
+
+ // If custom code is specified, emit it.
+ StringRef Code = R->getValueAsString("CustomCode");
+ if (!Code.empty()) {
+ AnyTargetChecks = true;
+ Test += " && (";
+ Test += Code;
+ Test += ")";
+ }
+
+ return AnyTargetChecks;
}
static void GenerateHasAttrSpellingStringSwitch(
@@ -3396,23 +3457,12 @@ static std::string GenerateLangOptRequirements(const Record &R,
if (LangOpts.empty())
return "defaultDiagnoseLangOpts";
- // Generate the test condition, as well as a unique function name for the
- // diagnostic test. The list of options should usually be short (one or two
- // options), and the uniqueness isn't strictly necessary (it is just for
- // codegen efficiency).
- std::string FnName = "check", Test;
- for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I) {
- const StringRef Part = (*I)->getValueAsString("Name");
- if ((*I)->getValueAsBit("Negated")) {
- FnName += "Not";
- Test += "!";
- }
- Test += "S.LangOpts.";
- Test += Part;
- if (I + 1 != E)
- Test += " || ";
- FnName += Part;
- }
+ // Generate a unique function name for the diagnostic test. The list of
+ // options should usually be short (one or two options), and the
+ // uniqueness isn't strictly necessary (it is just for codegen efficiency).
+ std::string FnName = "check";
+ for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I)
+ FnName += (*I)->getValueAsString("Name");
FnName += "LangOpts";
// If this code has already been generated, simply return the previous
@@ -3423,7 +3473,8 @@ static std::string GenerateLangOptRequirements(const Record &R,
return *I;
OS << "static bool " << FnName << "(Sema &S, const ParsedAttr &Attr) {\n";
- OS << " if (" << Test << ")\n";
+ OS << " auto &LangOpts = S.LangOpts;\n";
+ OS << " if (" << GenerateTestExpression(LangOpts) << ")\n";
OS << " return true;\n\n";
OS << " S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) ";
OS << "<< Attr.getName();\n";
@@ -3472,7 +3523,7 @@ static std::string GenerateTargetRequirements(const Record &Attr,
std::string FnName = "isTarget";
std::string Test;
- GenerateTargetSpecificAttrChecks(R, Arches, Test, &FnName);
+ bool UsesT = GenerateTargetSpecificAttrChecks(R, Arches, Test, &FnName);
// If this code has already been generated, simply return the previous
// instance of it.
@@ -3482,7 +3533,8 @@ static std::string GenerateTargetRequirements(const Record &Attr,
return *I;
OS << "static bool " << FnName << "(const TargetInfo &Target) {\n";
- OS << " const llvm::Triple &T = Target.getTriple();\n";
+ if (UsesT)
+ OS << " const llvm::Triple &T = Target.getTriple(); (void)T;\n";
OS << " return " << Test << ";\n";
OS << "}\n\n";
@@ -3767,6 +3819,7 @@ void EmitClangAttrParserStringSwitches(RecordKeeper &Records,
emitClangAttrArgContextList(Records, OS);
emitClangAttrIdentifierArgList(Records, OS);
emitClangAttrVariadicIdentifierArgList(Records, OS);
+ emitClangAttrThisIsaIdentifierArgList(Records, OS);
emitClangAttrTypeArgList(Records, OS);
emitClangAttrLateParsedList(Records, OS);
}
diff --git a/utils/TableGen/ClangCommentCommandInfoEmitter.cpp b/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
index 3522cd472d9d..c0dd70281a4d 100644
--- a/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
+++ b/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
@@ -1,9 +1,8 @@
//===--- ClangCommentCommandInfoEmitter.cpp - Generate command lists -----====//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp b/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
index 7c114dbe8e18..81af5b4b95f1 100644
--- a/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
+++ b/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
@@ -1,9 +1,8 @@
//===--- ClangCommentHTMLNamedCharacterReferenceEmitter.cpp -----------------=//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp b/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
index 477bbc8aaa56..7b9fdfcb3f20 100644
--- a/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
+++ b/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
@@ -1,9 +1,8 @@
//===--- ClangCommentHTMLTagsEmitter.cpp - Generate HTML tag list for Clang -=//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp
index f551d9328227..13e564e130ce 100644
--- a/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -1,9 +1,8 @@
//=- ClangDiagnosticsEmitter.cpp - Generate Clang diagnostics tables -*- C++ -*-
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
new file mode 100644
index 000000000000..8d83b1c7fa6b
--- /dev/null
+++ b/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -0,0 +1,318 @@
+//===- ClangOpenCLBuiltinEmitter.cpp - Generate Clang OpenCL Builtin handling
+//
+// The LLVM Compiler Infrastructure
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This tablegen backend emits code for checking whether a function is an
+// OpenCL builtin function. If so, all overloads of this function are
+// added to the LookupResult. The generated include file is used by
+// SemaLookup.cpp
+//
+// For a successful lookup of e.g. the "cos" builtin, isOpenCLBuiltin("cos")
+// returns a pair <Index, Len>.
+// OpenCLBuiltins[Index] to OpenCLBuiltins[Index + Len] contains the pairs
+// <SigIndex, SigLen> of the overloads of "cos".
+// OpenCLSignature[SigIndex] to OpenCLSignature[SigIndex + SigLen] contains
+// one of the signatures of "cos". The OpenCLSignature entry can be
+// referenced by other functions, i.e. "sin", since multiple OpenCL builtins
+// share the same signature.
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/StringMatcher.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include <set>
+
+using namespace llvm;
+
+namespace {
+class BuiltinNameEmitter {
+public:
+ BuiltinNameEmitter(RecordKeeper &Records, raw_ostream &OS)
+ : Records(Records), OS(OS) {}
+
+ // Entrypoint to generate the functions and structures for checking
+ // whether a function is an OpenCL builtin function.
+ void Emit();
+
+private:
+ // Contains OpenCL builtin functions and related information, stored as
+ // Record instances. They are coming from the associated TableGen file.
+ RecordKeeper &Records;
+
+ // The output file.
+ raw_ostream &OS;
+
+ // Emit the enums and structs.
+ void EmitDeclarations();
+
+ // Parse the Records generated by TableGen and populate OverloadInfo and
+ // SignatureSet.
+ void GetOverloads();
+
+ // Emit the OpenCLSignature table. This table contains all possible
+ // signatures, and is a struct OpenCLType. A signature is composed of a
+ // return type (mandatory), followed by zero or more argument types.
+ // E.g.:
+ // // 12
+ // { OCLT_uchar, 4, clang::LangAS::Default, false },
+ // { OCLT_float, 4, clang::LangAS::Default, false },
+ // This means that index 12 represents a signature
+ // - returning a uchar vector of 4 elements, and
+ // - taking as first argument a float vector of 4 elements.
+ void EmitSignatureTable();
+
+ // Emit the OpenCLBuiltins table. This table contains all overloads of
+ // each function, and is a struct OpenCLBuiltinDecl.
+ // E.g.:
+ // // acos
+ // { 2, 0, "", 100 },
+ // This means that the signature of this acos overload is defined in OpenCL
+ // version 1.0 (100) and does not belong to any extension (""). It has a
+ // 1 argument (+1 for the return type), stored at index 0 in the
+ // OpenCLSignature table.
+ void EmitBuiltinTable();
+
+ // Emit a StringMatcher function to check whether a function name is an
+ // OpenCL builtin function name.
+ void EmitStringMatcher();
+
+ // Emit a function returning the clang QualType instance associated with
+ // the TableGen Record Type.
+ void EmitQualTypeFinder();
+
+ // Contains a list of the available signatures, without the name of the
+ // function. Each pair consists of a signature and a cumulative index.
+ // E.g.: <<float, float>, 0>,
+ // <<float, int, int, 2>>,
+ // <<float>, 5>,
+ // ...
+ // <<double, double>, 35>.
+ std::vector<std::pair<std::vector<Record *>, unsigned>> SignatureSet;
+
+ // Map the name of a builtin function to its prototypes (instances of the
+ // TableGen "Builtin" class).
+ // Each prototype is registered as a pair of:
+ // <pointer to the "Builtin" instance,
+ // cumulative index of the associated signature in the SignatureSet>
+ // E.g.: The function cos: (float cos(float), double cos(double), ...)
+ // <"cos", <<ptrToPrototype0, 5>,
+ // <ptrToPrototype1, 35>>
+ // <ptrToPrototype2, 79>>
+ // ptrToPrototype1 has the following signature: <double, double>
+ MapVector<StringRef, std::vector<std::pair<const Record *, unsigned>>>
+ OverloadInfo;
+};
+} // namespace
+
+void BuiltinNameEmitter::Emit() {
+ emitSourceFileHeader("OpenCL Builtin handling", OS);
+
+ OS << "#include \"llvm/ADT/StringRef.h\"\n";
+ OS << "using namespace clang;\n\n";
+
+ EmitDeclarations();
+
+ GetOverloads();
+
+ EmitSignatureTable();
+
+ EmitBuiltinTable();
+
+ EmitStringMatcher();
+
+ EmitQualTypeFinder();
+}
+
+void BuiltinNameEmitter::EmitDeclarations() {
+ OS << "enum OpenCLTypeID {\n";
+ std::vector<Record *> Types = Records.getAllDerivedDefinitions("Type");
+ StringMap<bool> TypesSeen;
+ for (const auto *T : Types) {
+ if (TypesSeen.find(T->getValueAsString("Name")) == TypesSeen.end())
+ OS << " OCLT_" + T->getValueAsString("Name") << ",\n";
+ TypesSeen.insert(std::make_pair(T->getValueAsString("Name"), true));
+ }
+ OS << "};\n";
+
+ OS << R"(
+
+// Type used in a prototype of an OpenCL builtin function.
+struct OpenCLType {
+ // A type (e.g.: float, int, ...)
+ OpenCLTypeID ID;
+ // Size of vector (if applicable)
+ unsigned VectorWidth;
+ // Address space of the pointer (if applicable)
+ LangAS AS;
+ // Whether the type is a pointer
+ bool isPointer;
+};
+
+// One overload of an OpenCL builtin function.
+struct OpenCLBuiltinDecl {
+ // Number of arguments for the signature
+ unsigned NumArgs;
+ // Index in the OpenCLSignature table to get the required types
+ unsigned ArgTableIndex;
+ // Extension to which it belongs (e.g. cl_khr_subgroups)
+ const char *Extension;
+ // Version in which it was introduced (e.g. CL20)
+ unsigned Version;
+};
+
+)";
+}
+
+void BuiltinNameEmitter::GetOverloads() {
+ unsigned CumulativeSignIndex = 0;
+ std::vector<Record *> Builtins = Records.getAllDerivedDefinitions("Builtin");
+ for (const auto *B : Builtins) {
+ StringRef BName = B->getValueAsString("Name");
+ if (OverloadInfo.find(BName) == OverloadInfo.end()) {
+ OverloadInfo.insert(std::make_pair(
+ BName, std::vector<std::pair<const Record *, unsigned>>{}));
+ }
+
+ auto Signature = B->getValueAsListOfDefs("Signature");
+ auto it =
+ std::find_if(SignatureSet.begin(), SignatureSet.end(),
+ [&](const std::pair<std::vector<Record *>, unsigned> &a) {
+ return a.first == Signature;
+ });
+ unsigned SignIndex;
+ if (it == SignatureSet.end()) {
+ SignatureSet.push_back(std::make_pair(Signature, CumulativeSignIndex));
+ SignIndex = CumulativeSignIndex;
+ CumulativeSignIndex += Signature.size();
+ } else {
+ SignIndex = it->second;
+ }
+ OverloadInfo[BName].push_back(std::make_pair(B, SignIndex));
+ }
+}
+
+void BuiltinNameEmitter::EmitSignatureTable() {
+ OS << "static const OpenCLType OpenCLSignature[] = {\n";
+ for (auto &P : SignatureSet) {
+ OS << "// " << P.second << "\n";
+ for (Record *R : P.first) {
+ OS << "{ OCLT_" << R->getValueAsString("Name") << ", "
+ << R->getValueAsInt("VecWidth") << ", "
+ << R->getValueAsString("AddrSpace") << ", "
+ << R->getValueAsBit("IsPointer") << "},";
+ OS << "\n";
+ }
+ }
+ OS << "};\n\n";
+}
+
+void BuiltinNameEmitter::EmitBuiltinTable() {
+ OS << "static const OpenCLBuiltinDecl OpenCLBuiltins[] = {\n";
+ for (auto &i : OverloadInfo) {
+ StringRef Name = i.first;
+ OS << "// " << Name << "\n";
+ for (auto &Overload : i.second) {
+ OS << " { " << Overload.first->getValueAsListOfDefs("Signature").size()
+ << ", " << Overload.second << ", " << '"'
+ << Overload.first->getValueAsString("Extension") << "\", "
+ << Overload.first->getValueAsDef("Version")->getValueAsInt("Version")
+ << " },\n";
+ }
+ }
+ OS << "};\n\n";
+}
+
+void BuiltinNameEmitter::EmitStringMatcher() {
+ std::vector<StringMatcher::StringPair> ValidBuiltins;
+ unsigned CumulativeIndex = 1;
+ for (auto &i : OverloadInfo) {
+ auto &Ov = i.second;
+ std::string RetStmt;
+ raw_string_ostream SS(RetStmt);
+ SS << "return std::make_pair(" << CumulativeIndex << ", " << Ov.size()
+ << ");";
+ SS.flush();
+ CumulativeIndex += Ov.size();
+
+ ValidBuiltins.push_back(StringMatcher::StringPair(i.first, RetStmt));
+ }
+
+ OS << R"(
+// Return 0 if name is not a recognized OpenCL builtin, or an index
+// into a table of declarations if it is an OpenCL builtin.
+static std::pair<unsigned, unsigned> isOpenCLBuiltin(llvm::StringRef name) {
+
+)";
+
+ StringMatcher("name", ValidBuiltins, OS).Emit(0, true);
+
+ OS << " return std::make_pair(0, 0);\n";
+ OS << "}\n";
+}
+
+void BuiltinNameEmitter::EmitQualTypeFinder() {
+ OS << R"(
+
+static QualType OCL2Qual(ASTContext &Context, OpenCLType Ty) {
+ QualType RT = Context.VoidTy;
+ switch (Ty.ID) {
+)";
+
+ std::vector<Record *> Types = Records.getAllDerivedDefinitions("Type");
+ StringMap<bool> TypesSeen;
+
+ for (const auto *T : Types) {
+ // Check we have not seen this Type
+ if (TypesSeen.find(T->getValueAsString("Name")) != TypesSeen.end())
+ continue;
+ TypesSeen.insert(std::make_pair(T->getValueAsString("Name"), true));
+
+ // Check the Type does not have an "abstract" QualType
+ auto QT = T->getValueAsDef("QTName");
+ if (QT->getValueAsString("Name") == "null")
+ continue;
+
+ OS << " case OCLT_" << T->getValueAsString("Name") << ":\n";
+ OS << " RT = Context." << QT->getValueAsString("Name") << ";\n";
+ OS << " break;\n";
+ }
+ OS << " }\n";
+
+ // Special cases
+ OS << R"(
+ if (Ty.VectorWidth > 0)
+ RT = Context.getExtVectorType(RT, Ty.VectorWidth);
+
+ if (Ty.isPointer) {
+ RT = Context.getAddrSpaceQualType(RT, Ty.AS);
+ RT = Context.getPointerType(RT);
+ }
+
+ return RT;
+}
+)";
+}
+
+namespace clang {
+
+void EmitClangOpenCLBuiltins(RecordKeeper &Records, raw_ostream &OS) {
+ BuiltinNameEmitter NameChecker(Records, OS);
+ NameChecker.Emit();
+}
+
+} // end namespace clang
diff --git a/utils/TableGen/ClangOptionDocEmitter.cpp b/utils/TableGen/ClangOptionDocEmitter.cpp
index cf642ec92bd8..7027113c4fa8 100644
--- a/utils/TableGen/ClangOptionDocEmitter.cpp
+++ b/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -1,9 +1,8 @@
//===- ClangOptionDocEmitter.cpp - Documentation for command line flags ---===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// FIXME: Once this has stabilized, consider moving it to LLVM.
//
diff --git a/utils/TableGen/ClangSACheckersEmitter.cpp b/utils/TableGen/ClangSACheckersEmitter.cpp
index 57850a438720..7dd0895b76d4 100644
--- a/utils/TableGen/ClangSACheckersEmitter.cpp
+++ b/utils/TableGen/ClangSACheckersEmitter.cpp
@@ -1,9 +1,8 @@
//=- ClangSACheckersEmitter.cpp - Generate Clang SA checkers tables -*- C++ -*-
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -91,6 +90,90 @@ static std::string getCheckerDocs(const Record &R) {
.str();
}
+/// Retrieves the type from a CmdOptionTypeEnum typed Record object. Note that
+/// the class itself has to be modified for adding a new option type in
+/// CheckerBase.td.
+static std::string getCheckerOptionType(const Record &R) {
+ if (BitsInit *BI = R.getValueAsBitsInit("Type")) {
+ switch(getValueFromBitsInit(BI, R)) {
+ case 0:
+ return "int";
+ case 1:
+ return "string";
+ case 2:
+ return "bool";
+ }
+ }
+ PrintFatalError(R.getLoc(),
+ "unable to parse command line option type for "
+ + getCheckerFullName(&R));
+ return "";
+}
+
+static std::string getDevelopmentStage(const Record &R) {
+ if (BitsInit *BI = R.getValueAsBitsInit("DevelopmentStage")) {
+ switch(getValueFromBitsInit(BI, R)) {
+ case 0:
+ return "alpha";
+ case 1:
+ return "released";
+ }
+ }
+
+ PrintFatalError(R.getLoc(),
+ "unable to parse command line option type for "
+ + getCheckerFullName(&R));
+ return "";
+}
+
+static bool isHidden(const Record *R) {
+ if (R->getValueAsBit("Hidden"))
+ return true;
+
+ // Not declared as hidden, check the parent package if it is hidden.
+ if (DefInit *DI = dyn_cast<DefInit>(R->getValueInit("ParentPackage")))
+ return isHidden(DI->getDef());
+
+ return false;
+}
+
+static void printChecker(llvm::raw_ostream &OS, const Record &R) {
+ OS << "CHECKER(" << "\"";
+ OS.write_escaped(getCheckerFullName(&R)) << "\", ";
+ OS << R.getName() << ", ";
+ OS << "\"";
+ OS.write_escaped(getStringValue(R, "HelpText")) << "\", ";
+ OS << "\"";
+ OS.write_escaped(getCheckerDocs(R));
+ OS << "\", ";
+
+ if (!isHidden(&R))
+ OS << "false";
+ else
+ OS << "true";
+
+ OS << ")\n";
+}
+
+static void printOption(llvm::raw_ostream &OS, StringRef FullName,
+ const Record &R) {
+ OS << "\"";
+ OS.write_escaped(getCheckerOptionType(R)) << "\", \"";
+ OS.write_escaped(FullName) << "\", ";
+ OS << '\"' << getStringValue(R, "CmdFlag") << "\", ";
+ OS << '\"';
+ OS.write_escaped(getStringValue(R, "Desc")) << "\", ";
+ OS << '\"';
+ OS.write_escaped(getStringValue(R, "DefaultVal")) << "\", ";
+ OS << '\"';
+ OS << getDevelopmentStage(R) << "\", ";
+
+ if (!R.getValueAsBit("Hidden"))
+ OS << "false";
+ else
+ OS << "true";
+}
+
namespace clang {
void EmitClangSACheckers(RecordKeeper &Records, raw_ostream &OS) {
std::vector<Record*> checkers = Records.getAllDerivedDefinitions("Checker");
@@ -101,7 +184,12 @@ void EmitClangSACheckers(RecordKeeper &Records, raw_ostream &OS) {
OS << "// This file is automatically generated. Do not edit this file by "
"hand.\n";
- OS << "\n#ifdef GET_PACKAGES\n";
+ // Emit packages.
+ //
+ // PACKAGE(PACKAGENAME)
+ // - PACKAGENAME: The name of the package.
+ OS << "\n"
+ "#ifdef GET_PACKAGES\n";
{
SortedRecords sortedPackages;
for (unsigned i = 0, e = packages.size(); i != e; ++i)
@@ -116,22 +204,115 @@ void EmitClangSACheckers(RecordKeeper &Records, raw_ostream &OS) {
OS << ")\n";
}
}
- OS << "#endif // GET_PACKAGES\n\n";
-
- OS << "\n#ifdef GET_CHECKERS\n";
- for (unsigned i = 0, e = checkers.size(); i != e; ++i) {
- const Record &R = *checkers[i];
-
- OS << "CHECKER(" << "\"";
- OS.write_escaped(getCheckerFullName(&R)) << "\", ";
- OS << R.getName() << ", ";
- OS << "\"";
- OS.write_escaped(getStringValue(R, "HelpText")) << "\", ";
- OS << "\"";
- OS.write_escaped(getCheckerDocs(R));
- OS << "\"";
- OS << ")\n";
+ OS << "#endif // GET_PACKAGES\n"
+ "\n";
+
+ // Emit a package option.
+ //
+ // PACKAGE_OPTION(OPTIONTYPE, PACKAGENAME, OPTIONNAME, DESCRIPTION, DEFAULT)
+ // - OPTIONTYPE: Type of the option, whether it's integer or boolean etc.
+ // This is important for validating user input. Note that
+ // it's a string, rather than an actual type: since we can
+ // load checkers runtime, we can't use template hackery for
+ // sorting this out compile-time.
+ // - PACKAGENAME: Name of the package.
+ // - OPTIONNAME: Name of the option.
+ // - DESCRIPTION
+ // - DEFAULT: The default value for this option.
+ //
+ // The full option can be specified in the command like like this:
+ // -analyzer-config PACKAGENAME:OPTIONNAME=VALUE
+ OS << "\n"
+ "#ifdef GET_PACKAGE_OPTIONS\n";
+ for (const Record *Package : packages) {
+
+ if (Package->isValueUnset("PackageOptions"))
+ continue;
+
+ std::vector<Record *> PackageOptions = Package
+ ->getValueAsListOfDefs("PackageOptions");
+ for (Record *PackageOpt : PackageOptions) {
+ OS << "PACKAGE_OPTION(";
+ printOption(OS, getPackageFullName(Package), *PackageOpt);
+ OS << ")\n";
+ }
+ }
+ OS << "#endif // GET_PACKAGE_OPTIONS\n"
+ "\n";
+
+ // Emit checkers.
+ //
+ // CHECKER(FULLNAME, CLASS, HELPTEXT)
+ // - FULLNAME: The full name of the checker, including packages, e.g.:
+ // alpha.cplusplus.UninitializedObject
+ // - CLASS: The name of the checker, with "Checker" appended, e.g.:
+ // UninitializedObjectChecker
+ // - HELPTEXT: The description of the checker.
+ OS << "\n"
+ "#ifdef GET_CHECKERS\n"
+ "\n";
+ for (const Record *checker : checkers) {
+ printChecker(OS, *checker);
+ }
+ OS << "\n"
+ "#endif // GET_CHECKERS\n"
+ "\n";
+
+ // Emit dependencies.
+ //
+ // CHECKER_DEPENDENCY(FULLNAME, DEPENDENCY)
+ // - FULLNAME: The full name of the checker that depends on another checker.
+ // - DEPENDENCY: The full name of the checker FULLNAME depends on.
+ OS << "\n"
+ "#ifdef GET_CHECKER_DEPENDENCIES\n";
+ for (const Record *Checker : checkers) {
+ if (Checker->isValueUnset("Dependencies"))
+ continue;
+
+ for (const Record *Dependency :
+ Checker->getValueAsListOfDefs("Dependencies")) {
+ OS << "CHECKER_DEPENDENCY(";
+ OS << '\"';
+ OS.write_escaped(getCheckerFullName(Checker)) << "\", ";
+ OS << '\"';
+ OS.write_escaped(getCheckerFullName(Dependency)) << '\"';
+ OS << ")\n";
+ }
+ }
+ OS << "\n"
+ "#endif // GET_CHECKER_DEPENDENCIES\n";
+
+ // Emit a package option.
+ //
+ // CHECKER_OPTION(OPTIONTYPE, CHECKERNAME, OPTIONNAME, DESCRIPTION, DEFAULT)
+ // - OPTIONTYPE: Type of the option, whether it's integer or boolean etc.
+ // This is important for validating user input. Note that
+ // it's a string, rather than an actual type: since we can
+ // load checkers runtime, we can't use template hackery for
+ // sorting this out compile-time.
+ // - CHECKERNAME: Name of the package.
+ // - OPTIONNAME: Name of the option.
+ // - DESCRIPTION
+ // - DEFAULT: The default value for this option.
+ //
+ // The full option can be specified in the command like like this:
+ // -analyzer-config CHECKERNAME:OPTIONNAME=VALUE
+ OS << "\n"
+ "#ifdef GET_CHECKER_OPTIONS\n";
+ for (const Record *Checker : checkers) {
+
+ if (Checker->isValueUnset("CheckerOptions"))
+ continue;
+
+ std::vector<Record *> CheckerOptions = Checker
+ ->getValueAsListOfDefs("CheckerOptions");
+ for (Record *CheckerOpt : CheckerOptions) {
+ OS << "CHECKER_OPTION(";
+ printOption(OS, getCheckerFullName(Checker), *CheckerOpt);
+ OS << ")\n";
+ }
}
- OS << "#endif // GET_CHECKERS\n\n";
+ OS << "#endif // GET_CHECKER_OPTIONS\n"
+ "\n";
}
} // end namespace clang
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index f92110d5d7ac..5cb688061dcb 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -1,9 +1,8 @@
//===- NeonEmitter.cpp - Generate arm_neon.h for use with clang -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -2457,9 +2456,7 @@ void NeonEmitter::run(raw_ostream &OS) {
for (auto *I : Defs)
I->indexBody();
- std::stable_sort(
- Defs.begin(), Defs.end(),
- [](const Intrinsic *A, const Intrinsic *B) { return *A < *B; });
+ llvm::stable_sort(Defs, llvm::less_ptr<Intrinsic>());
// Only emit a def when its requirements have been met.
// FIXME: This loop could be made faster, but it's fast enough for now.
@@ -2472,7 +2469,7 @@ void NeonEmitter::run(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
- if (std::find(Defs.begin(), Defs.end(), II) != Defs.end())
+ if (llvm::is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
@@ -2566,9 +2563,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
for (auto *I : Defs)
I->indexBody();
- std::stable_sort(
- Defs.begin(), Defs.end(),
- [](const Intrinsic *A, const Intrinsic *B) { return *A < *B; });
+ llvm::stable_sort(Defs, llvm::less_ptr<Intrinsic>());
// Only emit a def when its requirements have been met.
// FIXME: This loop could be made faster, but it's fast enough for now.
@@ -2581,7 +2576,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
- if (std::find(Defs.begin(), Defs.end(), II) != Defs.end())
+ if (llvm::is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index f40d7f123353..b9ec90fd5bcc 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -1,9 +1,8 @@
//===- TableGen.cpp - Top-Level TableGen implementation for Clang ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -54,6 +53,7 @@ enum ActionType {
GenClangCommentHTMLNamedCharacterReferences,
GenClangCommentCommandInfo,
GenClangCommentCommandList,
+ GenClangOpenCLBuiltins,
GenArmNeon,
GenArmFP16,
GenArmNeonSema,
@@ -148,6 +148,8 @@ cl::opt<ActionType> Action(
clEnumValN(GenClangCommentCommandList, "gen-clang-comment-command-list",
"Generate list of commands that are used in "
"documentation comments"),
+ clEnumValN(GenClangOpenCLBuiltins, "gen-clang-opencl-builtins",
+ "Generate OpenCL builtin declaration handlers"),
clEnumValN(GenArmNeon, "gen-arm-neon", "Generate arm_neon.h for clang"),
clEnumValN(GenArmFP16, "gen-arm-fp16", "Generate arm_fp16.h for clang"),
clEnumValN(GenArmNeonSema, "gen-arm-neon-sema",
@@ -267,6 +269,9 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
case GenClangCommentCommandList:
EmitClangCommentCommandList(Records, OS);
break;
+ case GenClangOpenCLBuiltins:
+ EmitClangOpenCLBuiltins(Records, OS);
+ break;
case GenArmNeon:
EmitNeon(Records, OS);
break;
diff --git a/utils/TableGen/TableGenBackends.h b/utils/TableGen/TableGenBackends.h
index 410d0100be19..02af66c5bf81 100644
--- a/utils/TableGen/TableGenBackends.h
+++ b/utils/TableGen/TableGenBackends.h
@@ -1,9 +1,8 @@
//===- TableGenBackends.h - Declarations for Clang TableGen Backends ------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -19,9 +18,9 @@
#include <string>
namespace llvm {
- class raw_ostream;
- class RecordKeeper;
-}
+class raw_ostream;
+class RecordKeeper;
+} // namespace llvm
namespace clang {
@@ -29,22 +28,31 @@ void EmitClangDeclContext(llvm::RecordKeeper &RK, llvm::raw_ostream &OS);
void EmitClangASTNodes(llvm::RecordKeeper &RK, llvm::raw_ostream &OS,
const std::string &N, const std::string &S);
-void EmitClangAttrParserStringSwitches(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrSubjectMatchRulesParserStringSwitches(llvm::RecordKeeper &Records,
- llvm::raw_ostream &OS);
+void EmitClangAttrParserStringSwitches(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrSubjectMatchRulesParserStringSwitches(
+ llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangAttrClass(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangAttrImpl(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangAttrList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrSubjectMatchRuleList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangAttrSubjectMatchRuleList(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
void EmitClangAttrPCHRead(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangAttrPCHWrite(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrHasAttrImpl(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrSpellingListIndex(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrASTVisitor(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrTemplateInstantiate(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrParsedAttrList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangAttrParsedAttrKinds(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangAttrHasAttrImpl(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrSpellingListIndex(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrASTVisitor(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrTemplateInstantiate(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrParsedAttrList(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangAttrParsedAttrKinds(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
void EmitClangAttrTextNodeDump(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
void EmitClangAttrNodeTraverse(llvm::RecordKeeper &Records,
@@ -53,16 +61,22 @@ void EmitClangAttrNodeTraverse(llvm::RecordKeeper &Records,
void EmitClangDiagsDefs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS,
const std::string &Component);
void EmitClangDiagGroups(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangDiagsIndexName(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangDiagsIndexName(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
void EmitClangSACheckers(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangCommentHTMLNamedCharacterReferences(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangCommentHTMLNamedCharacterReferences(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
-void EmitClangCommentCommandInfo(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangCommentCommandList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangCommentCommandInfo(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+void EmitClangCommentCommandList(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
void EmitNeon(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitFP16(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
@@ -76,7 +90,11 @@ void EmitClangAttrDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangDiagDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
void EmitClangOptDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangDataCollectors(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitClangOpenCLBuiltins(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
+
+void EmitClangDataCollectors(llvm::RecordKeeper &Records,
+ llvm::raw_ostream &OS);
void EmitTestPragmaAttributeSupportedAttributes(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);