summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-03-06 17:55:00 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-03-06 17:55:00 +0000
commit5f97f24294a46877795d69580bb5ac560c9b1f9e (patch)
tree0ecb6e20a2d7d55b63ecd255c5d719f0753a607e /utils
parent46da5bf4f21300d7200bc86c488c4a3e39a9a676 (diff)
downloadclang-5f97f24294a46877795d69580bb5ac560c9b1f9e.tar.gz
TableGen: Give up on exact fixits for diagnostic groups
With recent changes in the TableGen frontend, we no longer have usable location information for anonymous defs. Fixes test breakage caused by r326788. The normal, non-error TableGen output is not affected by this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/ClangDiagnosticsEmitter.cpp38
1 files changed, 6 insertions, 32 deletions
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp
index d9d99e0bb0..4a2516ff94 100644
--- a/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -154,15 +154,6 @@ static bool beforeThanCompareGroups(const GroupInfo *LHS, const GroupInfo *RHS){
RHS->DiagsInGroup.front());
}
-static SMRange findSuperClassRange(const Record *R, StringRef SuperName) {
- ArrayRef<std::pair<Record *, SMRange>> Supers = R->getSuperClasses();
- auto I = std::find_if(Supers.begin(), Supers.end(),
- [&](const std::pair<Record *, SMRange> &SuperPair) {
- return SuperPair.first->getName() == SuperName;
- });
- return (I != Supers.end()) ? I->second : SMRange();
-}
-
/// \brief Invert the 1-[0/1] mapping of diags to group into a one to many
/// mapping of groups to diags in the group.
static void groupDiagnostics(const std::vector<Record*> &Diags,
@@ -236,22 +227,10 @@ static void groupDiagnostics(const std::vector<Record*> &Diags,
if (NextDiagGroup == (*I)->ExplicitDef)
continue;
- SMRange InGroupRange = findSuperClassRange(*DI, "InGroup");
- SmallString<64> Replacement;
- if (InGroupRange.isValid()) {
- Replacement += "InGroup<";
- Replacement += (*I)->ExplicitDef->getName();
- Replacement += ">";
- }
- SMFixIt FixIt(InGroupRange, Replacement);
-
- SrcMgr.PrintMessage(NextDiagGroup->getLoc().front(),
+ SrcMgr.PrintMessage((*DI)->getLoc().front(),
SourceMgr::DK_Error,
Twine("group '") + Name +
- "' is referred to anonymously",
- None,
- InGroupRange.isValid() ? FixIt
- : ArrayRef<SMFixIt>());
+ "' is referred to anonymously");
SrcMgr.PrintMessage((*I)->ExplicitDef->getLoc().front(),
SourceMgr::DK_Note, "group defined here");
}
@@ -266,19 +245,14 @@ static void groupDiagnostics(const std::vector<Record*> &Diags,
const Record *NextDiagGroup = GroupInit->getDef();
std::string Name = NextDiagGroup->getValueAsString("GroupName");
- SMRange InGroupRange = findSuperClassRange(*DI, "InGroup");
- SrcMgr.PrintMessage(NextDiagGroup->getLoc().front(),
+ SrcMgr.PrintMessage((*DI)->getLoc().front(),
SourceMgr::DK_Error,
Twine("group '") + Name +
- "' is referred to anonymously",
- InGroupRange);
+ "' is referred to anonymously");
for (++DI; DI != DE; ++DI) {
- GroupInit = cast<DefInit>((*DI)->getValueInit("Group"));
- InGroupRange = findSuperClassRange(*DI, "InGroup");
- SrcMgr.PrintMessage(GroupInit->getDef()->getLoc().front(),
- SourceMgr::DK_Note, "also referenced here",
- InGroupRange);
+ SrcMgr.PrintMessage((*DI)->getLoc().front(),
+ SourceMgr::DK_Note, "also referenced here");
}
}
}