diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /utils/TableGen/ClangDiagnosticsEmitter.cpp | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'utils/TableGen/ClangDiagnosticsEmitter.cpp')
-rw-r--r-- | utils/TableGen/ClangDiagnosticsEmitter.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp index 8615d2d..b1472a8 100644 --- a/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/Optional.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" #include <algorithm> @@ -75,7 +76,7 @@ getCategoryFromDiagGroup(const Record *Group, static std::string getDiagnosticCategory(const Record *R, DiagGroupParentMap &DiagGroupParents) { // If the diagnostic is in a group, and that group has a category, use it. - if (DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"))) { + if (DefInit *Group = dyn_cast<DefInit>(R->getValueInit("Group"))) { // Check the diagnostic's diag group for a category. std::string CatName = getCategoryFromDiagGroup(Group->getDef(), DiagGroupParents); @@ -136,7 +137,7 @@ static void groupDiagnostics(const std::vector<Record*> &Diags, std::map<std::string, GroupInfo> &DiagsInGroup) { for (unsigned i = 0, e = Diags.size(); i != e; ++i) { const Record *R = Diags[i]; - DefInit *DI = dynamic_cast<DefInit*>(R->getValueInit("Group")); + DefInit *DI = dyn_cast<DefInit>(R->getValueInit("Group")); if (DI == 0) continue; assert(R->getValueAsDef("Class")->getName() != "CLASS_NOTE" && "Note can't be in a DiagGroup"); @@ -280,7 +281,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic, Record *R = Diags[i]; if (isExtension(R) && isOffByDefault(R)) { DiagsSet.insert(R); - if (DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"))) { + if (DefInit *Group = dyn_cast<DefInit>(R->getValueInit("Group"))) { const Record *GroupRec = Group->getDef(); if (!isSubGroupOfGroup(GroupRec, "pedantic")) { markGroup(GroupRec); @@ -299,7 +300,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic, // Check if the group is implicitly in -Wpedantic. If so, // the diagnostic should not be directly included in the -Wpedantic // diagnostic group. - if (DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"))) + if (DefInit *Group = dyn_cast<DefInit>(R->getValueInit("Group"))) if (groupInPedantic(Group->getDef())) continue; @@ -391,11 +392,11 @@ void EmitClangDiagsDefs(RecordKeeper &Records, raw_ostream &OS, // Check if this is an error that is accidentally in a warning // group. if (isError(R)) { - if (DefInit *Group = dynamic_cast<DefInit*>(R.getValueInit("Group"))) { + if (DefInit *Group = dyn_cast<DefInit>(R.getValueInit("Group"))) { const Record *GroupRec = Group->getDef(); const std::string &GroupName = GroupRec->getValueAsString("GroupName"); - throw "Error " + R.getName() + " cannot be in a warning group [" + - GroupName + "]"; + PrintFatalError(R.getLoc(), "Error " + R.getName() + + " cannot be in a warning group [" + GroupName + "]"); } } @@ -413,7 +414,7 @@ void EmitClangDiagsDefs(RecordKeeper &Records, raw_ostream &OS, // Warning associated with the diagnostic. This is stored as an index into // the alphabetically sorted warning table. - if (DefInit *DI = dynamic_cast<DefInit*>(R.getValueInit("Group"))) { + if (DefInit *DI = dyn_cast<DefInit>(R.getValueInit("Group"))) { std::map<std::string, GroupInfo>::iterator I = DiagsInGroup.find(DI->getDef()->getValueAsString("GroupName")); assert(I != DiagsInGroup.end()); @@ -556,7 +557,8 @@ void EmitClangDiagGroups(RecordKeeper &Records, raw_ostream &OS) { if (I->first.find_first_not_of("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789!@#$%^*-+=:?")!=std::string::npos) - throw "Invalid character in diagnostic group '" + I->first + "'"; + PrintFatalError("Invalid character in diagnostic group '" + + I->first + "'"); OS.write_escaped(I->first) << "\"," << std::string(MaxLen-I->first.size()+1, ' '); |