Skip to content

Commit 44f3518

Browse files
committed
[BoundsSafety] Work around a regression in how macro-defined bounds-safety attributes are emitted in diagnostics
A recent auto-merged change from upstream d9ef62a seemed to remove the special handling on how macro-defined bounds-safety attributes are emitted in diagnostics. Adding the specialization for now to fix the test failure. The task to clean up the special handling of the macro defined attributes is tracked separately. This fixes test failures in   Clang :: BoundsSafety/Sema/attributes_in_template_decls_attr_only_mode.cpp   Clang :: BoundsSafety/Sema/complex-typespecs-with-bounds.c   Clang :: BoundsSafety/Sema/terminated-by-attr.c   Clang :: BoundsSafety/Sema/unsafe-late-const.c rdar://155652853
1 parent b270d53 commit 44f3518

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/include/clang/Sema/ParsedAttr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,15 @@ enum AttributeDeclKind {
11101110
ExpectedTypedef,
11111111
};
11121112

1113+
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
1114+
const ParsedAttr &At) {
1115+
const IdentifierInfo *AttrName =
1116+
At.printMacroName() ? At.getMacroIdentifier() : At.getAttrName();
1117+
DB.AddTaggedVal(reinterpret_cast<uint64_t>(AttrName),
1118+
DiagnosticsEngine::ak_identifierinfo);
1119+
return DB;
1120+
}
1121+
11131122
} // namespace clang
11141123

11151124
#endif // LLVM_CLANG_SEMA_PARSEDATTR_H

0 commit comments

Comments
 (0)