Skip to content

Commit 869b6fa

Browse files
authored
Merge pull request #35634 from apple/diagnostics-attr
Diagnostics: improve error message at attr diagnosis failure
2 parents 662b553 + 61f349c commit 869b6fa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ namespace {
5151
assert(!D->hasClangNode() && "Clang importer propagated a bogus attribute");
5252
if (!D->hasClangNode()) {
5353
SourceLoc loc = attr->getLocation();
54-
assert(loc.isValid() && "Diagnosing attribute with invalid location");
54+
#ifndef NDEBUG
55+
if (!loc.isValid()) {
56+
llvm::errs() << "Attribute '";
57+
attr->print(llvm::errs());
58+
llvm::errs() << "' has invalid location, failed to diagnose!\n";
59+
assert(false && "Diagnosing attribute with invalid location");
60+
}
61+
#endif
5562
if (loc.isInvalid()) {
5663
loc = D->getLoc();
5764
}

0 commit comments

Comments
 (0)