Skip to content

Commit 52283ca

Browse files
committed
remove useless overloads
1 parent 7837354 commit 52283ca

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -297,43 +297,16 @@ inline bool doesKeywordAttributeTakeArgs(tok::TokenKind Kind) {
297297
}
298298
}
299299

300-
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
301-
const AttributeCommonInfo &CI) {
302-
DB.AddTaggedVal(reinterpret_cast<uint64_t>(&CI),
303-
DiagnosticsEngine::ak_attr_info);
304-
return DB;
305-
}
306-
307300
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
308301
const AttributeCommonInfo *CI) {
309302
DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI),
310303
DiagnosticsEngine::ak_attr_info);
311304
return DB;
312305
}
313306

314-
/// AttributeCommonInfo has a non-explicit constructor which takes an
315-
/// SourceRange as its only argument, this constructor has many uses so making
316-
/// it explicit is hard. This constructor causes ambiguity with
317-
/// DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, SourceRange R).
318-
/// We use SFINAE to disable any conversion and remove any ambiguity.
319-
template <
320-
typename ACI,
321-
std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
322307
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
323-
const ACI &CI) {
324-
DB.AddTaggedVal(reinterpret_cast<uint64_t>(&CI),
325-
DiagnosticsEngine::ak_attr_info);
326-
return DB;
327-
}
328-
329-
template <
330-
typename ACI,
331-
std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
332-
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
333-
const ACI *CI) {
334-
DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI),
335-
DiagnosticsEngine::ak_attr_info);
336-
return DB;
308+
const AttributeCommonInfo &CI) {
309+
return DB << &CI;
337310
}
338311

339312
} // namespace clang

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {
12251225
}
12261226
}
12271227

1228-
S.Diag(AL.getLoc(), diag::err_attribute_preferred_name_arg_invalid)
1228+
S.Diag(AL.getLoc(), diag::err_attribute_not_typedef_for_specialization)
12291229
<< T << AL << CTD;
12301230
if (const auto *TT = T->getAs<TypedefType>())
12311231
S.Diag(TT->getDecl()->getLocation(), diag::note_entity_declared_at)
@@ -4146,7 +4146,7 @@ static void handleCallbackAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
41464146
}
41474147

41484148
if (CalleeFnProtoType->getNumParams() != EncodingIndices.size() - 1) {
4149-
S.Diag(AL.getLoc(), diag::err_callback_attribute_wrong_arg_count)
4149+
S.Diag(AL.getLoc(), diag::err_attribute_wrong_arg_count_for_func)
41504150
<< AL << QualType{CalleeFnProtoType, 0}
41514151
<< CalleeFnProtoType->getNumParams()
41524152
<< (unsigned)(EncodingIndices.size() - 1);

0 commit comments

Comments
 (0)