Skip to content

Commit 20c93df

Browse files
authored
[BoundsSafety] Work around a regression in how macro-defined bounds-safety attributes are emitted in diagnostics (#10993) (#11081)
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 92d1fb7 commit 20c93df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/include/clang/Sema/ParsedAttr.h

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

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

11151127
#endif // LLVM_CLANG_SEMA_PARSEDATTR_H

0 commit comments

Comments
 (0)