This revision was automatically updated to reflect the committed changes.
Closed by commit rL304326: [TableGen] Clang changes to support
Record::getValueAsString and… (authored by ctopper).
Changed prior to commit:
https://reviews.llvm.org/D33711?vs=100826&id=100906#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33711
Files:
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp
Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
===
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
@@ -718,9 +718,9 @@
};
// Unique the enums, but maintain the original declaration ordering.
- std::vector
- uniqueEnumsInOrder(const std::vector &enums) {
-std::vector uniques;
+ std::vector
+ uniqueEnumsInOrder(const std::vector &enums) {
+std::vector uniques;
SmallDenseSet unique_set;
for (const auto &i : enums) {
if (unique_set.insert(i).second)
@@ -731,7 +731,8 @@
class EnumArgument : public Argument {
std::string type;
-std::vector values, enums, uniques;
+std::vector values, enums, uniques;
+
public:
EnumArgument(const Record &Arg, StringRef Attr)
: Argument(Arg, Attr), type(Arg.getValueAsString("Type")),
@@ -850,7 +851,7 @@
class VariadicEnumArgument: public VariadicArgument {
std::string type, QualifiedTypeName;
-std::vector values, enums, uniques;
+std::vector values, enums, uniques;
protected:
void writeValueImpl(raw_ostream &OS) const override {
@@ -1591,17 +1592,18 @@
}
std::string getEnumValueName() const {
-std::string Result =
-"SubjectMatchRule_" + MetaSubject->getValueAsString("Name");
+SmallString<128> Result;
+Result += "SubjectMatchRule_";
+Result += MetaSubject->getValueAsString("Name");
if (isSubRule()) {
Result += "_";
if (isNegatedSubRule())
Result += "not_";
Result += Constraint->getValueAsString("Name");
}
if (isAbstractRule())
Result += "_abstract";
-return Result;
+return Result.str();
}
std::string getEnumValue() const { return "attr::" + getEnumValueName(); }
@@ -2603,7 +2605,7 @@
// append a unique suffix to distinguish this set of target checks from other
// TargetSpecificAttr records.
static void GenerateTargetSpecificAttrChecks(const Record *R,
- std::vector &Arches,
+ std::vector &Arches,
std::string &Test,
std::string *FnName) {
// It is assumed that there will be an llvm::Triple object
@@ -2613,8 +2615,9 @@
Test += "(";
for (auto I = Arches.begin(), E = Arches.end(); I != E; ++I) {
-std::string Part = *I;
-Test += "T.getArch() == llvm::Triple::" + Part;
+StringRef Part = *I;
+Test += "T.getArch() == llvm::Triple::";
+Test += Part;
if (I + 1 != E)
Test += " || ";
if (FnName)
@@ -2627,11 +2630,12 @@
// We know that there was at least one arch test, so we need to and in the
// OS tests.
Test += " && (";
-std::vector OSes = R->getValueAsListOfStrings("OSes");
+std::vector OSes = R->getValueAsListOfStrings("OSes");
for (auto I = OSes.begin(), E = OSes.end(); I != E; ++I) {
- std::string Part = *I;
+ StringRef Part = *I;
- Test += "T.getOS() == llvm::Triple::" + Part;
+ Test += "T.getOS() == llvm::Triple::";
+ Test += Part;
if (I + 1 != E)
Test += " || ";
if (FnName)
@@ -2643,10 +2647,11 @@
// If one or more CXX ABIs are specified, check those as well.
if (!R->isValueUnset("CXXABIs")) {
Test += " && (";
-std::vector CXXABIs = R->getValueAsListOfStrings("CXXABIs");
+std::vector CXXABIs = R->getValueAsListOfStrings("CXXABIs");
for (auto I = CXXABIs.begin(), E = CXXABIs.end(); I != E; ++I) {
- std::string Part = *I;
- Test += "Target.getCXXABI().getKind() == TargetCXXABI::" + Part;
+ StringRef Part = *I;
+ Test += "Target.getCXXABI().getKind() == TargetCXXABI::";
+ Test += Part;
if (I + 1 != E)
Test += " || ";
if (FnName)
@@ -2684,7 +2689,7 @@
std::string Test;
if (Attr->isSubClassOf("TargetSpecificAttr")) {
const Record *R = Attr->getValueAsDef("Target");
- std::vector Arches = R->getValueAsListOfStrings("Arches");
+ std::vector Arches = R->getValueAsListOfStrings("Arches");
GenerateTargetSpecificAttrChecks(R, Arches, Test, nullptr);
// If this is the C++11 variety, also add in the LangOpts test.
@@ -3323,7 +3328,7 @@
// Get the list of architectures to be tested for.
const Record *R = Attr.getValueAsD