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,8 +1592,9 @@ } 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()) @@ -1601,7 +1603,7 @@ } 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.getValueAsDef("Target"); - std::vector Arches = R->getValueAsListOfStrings("Arches"); + std::vector Arches = R->getValueAsListOfStrings("Arches"); if (Arches.empty()) { PrintError(Attr.getLoc(), "Empty list of target architectures for a " "target-specific attr"); @@ -3340,9 +3345,10 @@ std::string APK = Attr.getValueAsString("ParseKind"); for (const auto &I : Dupes) { if (I.first == APK) { - std::vector DA = I.second->getValueAsDef("Target") - ->getValueAsListOfStrings("Arches"); - std::move(DA.begin(), DA.end(), std::back_inserter(Arches)); + std::vector DA = + I.second->getValueAsDef("Target")->getValueAsListOfStrings( + "Arches"); + Arches.insert(Arches.end(), DA.begin(), DA.end()); } } } Index: cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp =================================================================== --- cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -1277,8 +1277,8 @@ bool IsSynonym = GroupInfo.DiagsInGroup.empty() && GroupInfo.SubGroups.size() == 1; - writeHeader((IsRemarkGroup ? "-R" : "-W") + - G->getValueAsString("GroupName"), + writeHeader(((IsRemarkGroup ? "-R" : "-W") + + G->getValueAsString("GroupName")).str(), OS); if (!IsSynonym) { Index: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp =================================================================== --- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp +++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp @@ -83,7 +83,7 @@ } // Pretend no-X and Xno-Y options are aliases of X and XY. - auto Name = R->getValueAsString("Name"); + std::string Name = R->getValueAsString("Name"); if (Name.size() >= 4) { if (Name.substr(0, 3) == "no-" && OptionsByName[Name.substr(3)]) { Aliases[OptionsByName[Name.substr(3)]].push_back(R); @@ -229,7 +229,7 @@ } void emitOptionWithArgs(StringRef Prefix, const Record *Option, - ArrayRef Args, raw_ostream &OS) { + ArrayRef Args, raw_ostream &OS) { OS << Prefix << escapeRST(Option->getValueAsString("Name")); std::pair Separators = @@ -261,14 +261,15 @@ } } - emitOptionWithArgs(Prefix, Option, Args, OS); + emitOptionWithArgs(Prefix, Option, std::vector(Args.begin(), Args.end()), OS); auto AliasArgs = Option->getValueAsListOfStrings("AliasArgs"); if (!AliasArgs.empty()) { Record *Alias = Option->getValueAsDef("Alias"); OS << " (equivalent to "; - emitOptionWithArgs(Alias->getValueAsListOfStrings("Prefixes").front(), - Alias, Option->getValueAsListOfStrings("AliasArgs"), OS); + emitOptionWithArgs( + Alias->getValueAsListOfStrings("Prefixes").front(), Alias, + AliasArgs, OS); OS << ")"; } } @@ -310,7 +311,7 @@ forEachOptionName(Option, DocInfo, [&](const Record *Option) { for (auto &Prefix : Option->getValueAsListOfStrings("Prefixes")) SphinxOptionIDs.push_back( - getSphinxOptionID(Prefix + Option->getValueAsString("Name"))); + getSphinxOptionID((Prefix + Option->getValueAsString("Name")).str())); }); assert(!SphinxOptionIDs.empty() && "no flags for option"); static std::map NextSuffix; Index: cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp =================================================================== --- cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp +++ cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp @@ -51,7 +51,8 @@ static std::string getPackageFullName(const Record *R) { std::string name = getParentPackageFullName(R); if (!name.empty()) name += "."; - return name + R->getValueAsString("PackageName"); + name += R->getValueAsString("PackageName"); + return name; } static std::string getCheckerFullName(const Record *R) {