Updated to Clang 3.5a.
Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp
index db159d1..40af9f6 100644
--- a/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -472,6 +472,11 @@
return ClsName == "CLASS_ERROR";
}
+static bool isRemark(const Record &Diag) {
+ const std::string &ClsName = Diag.getValueAsDef("Class")->getName();
+ return ClsName == "CLASS_REMARK";
+}
+
/// ClangDiagsDefsEmitter - The top-level class emits .def files containing
/// declarations of Clang diagnostics.
namespace clang {
@@ -518,6 +523,14 @@
}
}
+ // Check that all remarks have an associated diagnostic group.
+ if (isRemark(R)) {
+ if (!isa<DefInit>(R.getValueInit("Group"))) {
+ PrintFatalError(R.getLoc(), "Error " + R.getName() +
+ " not in any diagnostic group");
+ }
+ }
+
// Filter by component.
if (!Component.empty() && Component != R.getValueAsString("Component"))
continue;
@@ -748,17 +761,6 @@
std::string Name;
};
-
-struct RecordIndexElementSorter :
- public std::binary_function<RecordIndexElement, RecordIndexElement, bool> {
-
- bool operator()(RecordIndexElement const &Lhs,
- RecordIndexElement const &Rhs) const {
- return Lhs.Name < Rhs.Name;
- }
-
-};
-
} // end anonymous namespace.
namespace clang {
@@ -773,7 +775,9 @@
Index.push_back(RecordIndexElement(R));
}
- std::sort(Index.begin(), Index.end(), RecordIndexElementSorter());
+ std::sort(Index.begin(), Index.end(),
+ [](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];