1 //===--- DiagnosticIDs.cpp - Diagnostic IDs Handling ----------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Diagnostic IDs-related interfaces.
12 //===----------------------------------------------------------------------===//
14 #include "clang/Basic/DiagnosticIDs.h"
15 #include "clang/Basic/AllDiagnostics.h"
16 #include "clang/Basic/DiagnosticCategories.h"
17 #include "clang/Basic/SourceManager.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/Support/ErrorHandling.h"
22 using namespace clang;
24 //===----------------------------------------------------------------------===//
25 // Builtin Diagnostic information
26 //===----------------------------------------------------------------------===//
30 // Diagnostic classes.
34 CLASS_EXTENSION = 0x03,
38 struct StaticDiagInfoRec {
39 unsigned short DiagID;
43 unsigned AccessControl : 1;
44 unsigned WarnNoWerror : 1;
45 unsigned WarnShowInSystemHeader : 1;
46 unsigned Category : 5;
48 uint16_t OptionGroupIndex;
50 uint16_t DescriptionLen;
51 const char *DescriptionStr;
53 unsigned getOptionGroupIndex() const {
54 return OptionGroupIndex;
57 StringRef getDescription() const {
58 return StringRef(DescriptionStr, DescriptionLen);
61 bool operator<(const StaticDiagInfoRec &RHS) const {
62 return DiagID < RHS.DiagID;
66 } // namespace anonymous
68 static const StaticDiagInfoRec StaticDiagInfo[] = {
69 #define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP, \
70 SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER, \
72 { diag::ENUM, DEFAULT_MAPPING, CLASS, SFINAE, ACCESS, \
73 NOWERROR, SHOWINSYSHEADER, CATEGORY, GROUP, \
74 STR_SIZE(DESC, uint16_t), DESC },
75 #include "clang/Basic/DiagnosticCommonKinds.inc"
76 #include "clang/Basic/DiagnosticDriverKinds.inc"
77 #include "clang/Basic/DiagnosticFrontendKinds.inc"
78 #include "clang/Basic/DiagnosticSerializationKinds.inc"
79 #include "clang/Basic/DiagnosticLexKinds.inc"
80 #include "clang/Basic/DiagnosticParseKinds.inc"
81 #include "clang/Basic/DiagnosticASTKinds.inc"
82 #include "clang/Basic/DiagnosticCommentKinds.inc"
83 #include "clang/Basic/DiagnosticSemaKinds.inc"
84 #include "clang/Basic/DiagnosticAnalysisKinds.inc"
86 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
89 static const unsigned StaticDiagInfoSize =
90 sizeof(StaticDiagInfo)/sizeof(StaticDiagInfo[0])-1;
92 /// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID,
93 /// or null if the ID is invalid.
94 static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) {
95 // If assertions are enabled, verify that the StaticDiagInfo array is sorted.
97 static bool IsFirst = true;
99 for (unsigned i = 1; i != StaticDiagInfoSize; ++i) {
100 assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID &&
101 "Diag ID conflict, the enums at the start of clang::diag (in "
102 "DiagnosticIDs.h) probably need to be increased");
104 assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&
105 "Improperly sorted diag info");
111 // Search the diagnostic table with a binary search.
112 StaticDiagInfoRec Find = { static_cast<unsigned short>(DiagID),
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
115 const StaticDiagInfoRec *Found =
116 std::lower_bound(StaticDiagInfo, StaticDiagInfo + StaticDiagInfoSize, Find);
117 if (Found == StaticDiagInfo + StaticDiagInfoSize ||
118 Found->DiagID != DiagID)
124 static DiagnosticMappingInfo GetDefaultDiagMappingInfo(unsigned DiagID) {
125 DiagnosticMappingInfo Info = DiagnosticMappingInfo::Make(
126 diag::MAP_FATAL, /*IsUser=*/false, /*IsPragma=*/false);
128 if (const StaticDiagInfoRec *StaticInfo = GetDiagInfo(DiagID)) {
129 Info.setMapping((diag::Mapping) StaticInfo->Mapping);
131 if (StaticInfo->WarnNoWerror) {
132 assert(Info.getMapping() == diag::MAP_WARNING &&
133 "Unexpected mapping with no-Werror bit!");
134 Info.setNoWarningAsError(true);
137 if (StaticInfo->WarnShowInSystemHeader) {
138 assert(Info.getMapping() == diag::MAP_WARNING &&
139 "Unexpected mapping with show-in-system-header bit!");
140 Info.setShowInSystemHeader(true);
147 /// getCategoryNumberForDiag - Return the category number that a specified
148 /// DiagID belongs to, or 0 if no category.
149 unsigned DiagnosticIDs::getCategoryNumberForDiag(unsigned DiagID) {
150 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
151 return Info->Category;
156 // The diagnostic category names.
157 struct StaticDiagCategoryRec {
161 StringRef getName() const {
162 return StringRef(NameStr, NameLen);
167 // Unfortunately, the split between DiagnosticIDs and Diagnostic is not
168 // particularly clean, but for now we just implement this method here so we can
169 // access GetDefaultDiagMapping.
170 DiagnosticMappingInfo &DiagnosticsEngine::DiagState::getOrAddMappingInfo(
173 std::pair<iterator, bool> Result = DiagMap.insert(
174 std::make_pair(Diag, DiagnosticMappingInfo()));
176 // Initialize the entry if we added it.
178 Result.first->second = GetDefaultDiagMappingInfo(Diag);
180 return Result.first->second;
183 static const StaticDiagCategoryRec CategoryNameTable[] = {
184 #define GET_CATEGORY_TABLE
185 #define CATEGORY(X, ENUM) { X, STR_SIZE(X, uint8_t) },
186 #include "clang/Basic/DiagnosticGroups.inc"
187 #undef GET_CATEGORY_TABLE
191 /// getNumberOfCategories - Return the number of categories
192 unsigned DiagnosticIDs::getNumberOfCategories() {
193 return sizeof(CategoryNameTable) / sizeof(CategoryNameTable[0])-1;
196 /// getCategoryNameFromID - Given a category ID, return the name of the
197 /// category, an empty string if CategoryID is zero, or null if CategoryID is
199 StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) {
200 if (CategoryID >= getNumberOfCategories())
202 return CategoryNameTable[CategoryID].getName();
207 DiagnosticIDs::SFINAEResponse
208 DiagnosticIDs::getDiagnosticSFINAEResponse(unsigned DiagID) {
209 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) {
210 if (Info->AccessControl)
211 return SFINAE_AccessControl;
214 return SFINAE_Report;
216 if (Info->Class == CLASS_ERROR)
217 return SFINAE_SubstitutionFailure;
219 // Suppress notes, warnings, and extensions;
220 return SFINAE_Suppress;
223 return SFINAE_Report;
226 /// getBuiltinDiagClass - Return the class field of the diagnostic.
228 static unsigned getBuiltinDiagClass(unsigned DiagID) {
229 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
234 //===----------------------------------------------------------------------===//
235 // Custom Diagnostic information
236 //===----------------------------------------------------------------------===//
240 class CustomDiagInfo {
241 typedef std::pair<DiagnosticIDs::Level, std::string> DiagDesc;
242 std::vector<DiagDesc> DiagInfo;
243 std::map<DiagDesc, unsigned> DiagIDs;
246 /// getDescription - Return the description of the specified custom
248 StringRef getDescription(unsigned DiagID) const {
249 assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() &&
250 "Invalid diagnosic ID");
251 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second;
254 /// getLevel - Return the level of the specified custom diagnostic.
255 DiagnosticIDs::Level getLevel(unsigned DiagID) const {
256 assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() &&
257 "Invalid diagnosic ID");
258 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first;
261 unsigned getOrCreateDiagID(DiagnosticIDs::Level L, StringRef Message,
262 DiagnosticIDs &Diags) {
263 DiagDesc D(L, Message);
264 // Check to see if it already exists.
265 std::map<DiagDesc, unsigned>::iterator I = DiagIDs.lower_bound(D);
266 if (I != DiagIDs.end() && I->first == D)
269 // If not, assign a new ID.
270 unsigned ID = DiagInfo.size()+DIAG_UPPER_LIMIT;
271 DiagIDs.insert(std::make_pair(D, ID));
272 DiagInfo.push_back(D);
277 } // end diag namespace
278 } // end clang namespace
281 //===----------------------------------------------------------------------===//
282 // Common Diagnostic implementation
283 //===----------------------------------------------------------------------===//
285 DiagnosticIDs::DiagnosticIDs() {
289 DiagnosticIDs::~DiagnosticIDs() {
290 delete CustomDiagInfo;
293 /// getCustomDiagID - Return an ID for a diagnostic with the specified message
294 /// and level. If this is the first request for this diagnosic, it is
295 /// registered and created, otherwise the existing ID is returned.
296 unsigned DiagnosticIDs::getCustomDiagID(Level L, StringRef Message) {
297 if (CustomDiagInfo == 0)
298 CustomDiagInfo = new diag::CustomDiagInfo();
299 return CustomDiagInfo->getOrCreateDiagID(L, Message, *this);
303 /// isBuiltinWarningOrExtension - Return true if the unmapped diagnostic
304 /// level of the specified diagnostic ID is a Warning or Extension.
305 /// This only works on builtin diagnostics, not custom ones, and is not legal to
307 bool DiagnosticIDs::isBuiltinWarningOrExtension(unsigned DiagID) {
308 return DiagID < diag::DIAG_UPPER_LIMIT &&
309 getBuiltinDiagClass(DiagID) != CLASS_ERROR;
312 /// \brief Determine whether the given built-in diagnostic ID is a
314 bool DiagnosticIDs::isBuiltinNote(unsigned DiagID) {
315 return DiagID < diag::DIAG_UPPER_LIMIT &&
316 getBuiltinDiagClass(DiagID) == CLASS_NOTE;
319 /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic
320 /// ID is for an extension of some sort. This also returns EnabledByDefault,
321 /// which is set to indicate whether the diagnostic is ignored by default (in
322 /// which case -pedantic enables it) or treated as a warning/error by default.
324 bool DiagnosticIDs::isBuiltinExtensionDiag(unsigned DiagID,
325 bool &EnabledByDefault) {
326 if (DiagID >= diag::DIAG_UPPER_LIMIT ||
327 getBuiltinDiagClass(DiagID) != CLASS_EXTENSION)
331 GetDefaultDiagMappingInfo(DiagID).getMapping() != diag::MAP_IGNORE;
335 bool DiagnosticIDs::isDefaultMappingAsError(unsigned DiagID) {
336 if (DiagID >= diag::DIAG_UPPER_LIMIT)
339 return GetDefaultDiagMappingInfo(DiagID).getMapping() == diag::MAP_ERROR;
342 /// getDescription - Given a diagnostic ID, return a description of the
344 StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
345 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
346 return Info->getDescription();
347 return CustomDiagInfo->getDescription(DiagID);
350 /// getDiagnosticLevel - Based on the way the client configured the
351 /// DiagnosticsEngine object, classify the specified diagnostic ID into a Level,
352 /// by consumable the DiagnosticClient.
354 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
355 const DiagnosticsEngine &Diag) const {
356 // Handle custom diagnostics, which cannot be mapped.
357 if (DiagID >= diag::DIAG_UPPER_LIMIT)
358 return CustomDiagInfo->getLevel(DiagID);
360 unsigned DiagClass = getBuiltinDiagClass(DiagID);
361 if (DiagClass == CLASS_NOTE) return DiagnosticIDs::Note;
362 return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag);
365 /// \brief Based on the way the client configured the Diagnostic
366 /// object, classify the specified diagnostic ID into a Level, consumable by
367 /// the DiagnosticClient.
369 /// \param Loc The source location we are interested in finding out the
370 /// diagnostic state. Can be null in order to query the latest state.
372 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
374 const DiagnosticsEngine &Diag) const {
375 // Specific non-error diagnostics may be mapped to various levels from ignored
376 // to error. Errors can only be mapped to fatal.
377 DiagnosticIDs::Level Result = DiagnosticIDs::Fatal;
379 DiagnosticsEngine::DiagStatePointsTy::iterator
380 Pos = Diag.GetDiagStatePointForLoc(Loc);
381 DiagnosticsEngine::DiagState *State = Pos->State;
383 // Get the mapping information, or compute it lazily.
384 DiagnosticMappingInfo &MappingInfo = State->getOrAddMappingInfo(
387 switch (MappingInfo.getMapping()) {
388 case diag::MAP_IGNORE:
389 Result = DiagnosticIDs::Ignored;
391 case diag::MAP_WARNING:
392 Result = DiagnosticIDs::Warning;
394 case diag::MAP_ERROR:
395 Result = DiagnosticIDs::Error;
397 case diag::MAP_FATAL:
398 Result = DiagnosticIDs::Fatal;
402 // Upgrade ignored diagnostics if -Weverything is enabled.
403 if (Diag.EnableAllWarnings && Result == DiagnosticIDs::Ignored &&
404 !MappingInfo.isUser())
405 Result = DiagnosticIDs::Warning;
407 // Ignore -pedantic diagnostics inside __extension__ blocks.
408 // (The diagnostics controlled by -pedantic are the extension diagnostics
409 // that are not enabled by default.)
410 bool EnabledByDefault = false;
411 bool IsExtensionDiag = isBuiltinExtensionDiag(DiagID, EnabledByDefault);
412 if (Diag.AllExtensionsSilenced && IsExtensionDiag && !EnabledByDefault)
413 return DiagnosticIDs::Ignored;
415 // For extension diagnostics that haven't been explicitly mapped, check if we
416 // should upgrade the diagnostic.
417 if (IsExtensionDiag && !MappingInfo.isUser()) {
418 switch (Diag.ExtBehavior) {
419 case DiagnosticsEngine::Ext_Ignore:
421 case DiagnosticsEngine::Ext_Warn:
422 // Upgrade ignored diagnostics to warnings.
423 if (Result == DiagnosticIDs::Ignored)
424 Result = DiagnosticIDs::Warning;
426 case DiagnosticsEngine::Ext_Error:
427 // Upgrade ignored or warning diagnostics to errors.
428 if (Result == DiagnosticIDs::Ignored || Result == DiagnosticIDs::Warning)
429 Result = DiagnosticIDs::Error;
434 // At this point, ignored errors can no longer be upgraded.
435 if (Result == DiagnosticIDs::Ignored)
438 // Honor -w, which is lower in priority than pedantic-errors, but higher than
440 if (Result == DiagnosticIDs::Warning && Diag.IgnoreAllWarnings)
441 return DiagnosticIDs::Ignored;
443 // If -Werror is enabled, map warnings to errors unless explicitly disabled.
444 if (Result == DiagnosticIDs::Warning) {
445 if (Diag.WarningsAsErrors && !MappingInfo.hasNoWarningAsError())
446 Result = DiagnosticIDs::Error;
449 // If -Wfatal-errors is enabled, map errors to fatal unless explicity
451 if (Result == DiagnosticIDs::Error) {
452 if (Diag.ErrorsAsFatal && !MappingInfo.hasNoErrorAsFatal())
453 Result = DiagnosticIDs::Fatal;
456 // If we are in a system header, we ignore it. We look at the diagnostic class
457 // because we also want to ignore extensions and warnings in -Werror and
458 // -pedantic-errors modes, which *map* warnings/extensions to errors.
459 if (Result >= DiagnosticIDs::Warning &&
460 DiagClass != CLASS_ERROR &&
461 // Custom diagnostics always are emitted in system headers.
462 DiagID < diag::DIAG_UPPER_LIMIT &&
463 !MappingInfo.hasShowInSystemHeader() &&
464 Diag.SuppressSystemWarnings &&
466 Diag.getSourceManager().isInSystemHeader(
467 Diag.getSourceManager().getExpansionLoc(Loc)))
468 return DiagnosticIDs::Ignored;
473 struct clang::WarningOption {
474 // Be safe with the size of 'NameLen' because we don't statically check if
475 // the size will fit in the field; the struct size won't decrease with a
476 // shorter type anyway.
479 const short *Members;
480 const short *SubGroups;
482 StringRef getName() const {
483 return StringRef(NameStr, NameLen);
487 #define GET_DIAG_ARRAYS
488 #include "clang/Basic/DiagnosticGroups.inc"
489 #undef GET_DIAG_ARRAYS
491 // Second the table of options, sorted by name for fast binary lookup.
492 static const WarningOption OptionTable[] = {
493 #define GET_DIAG_TABLE
494 #include "clang/Basic/DiagnosticGroups.inc"
495 #undef GET_DIAG_TABLE
497 static const size_t OptionTableSize =
498 sizeof(OptionTable) / sizeof(OptionTable[0]);
500 static bool WarningOptionCompare(const WarningOption &LHS,
501 const WarningOption &RHS) {
502 return LHS.getName() < RHS.getName();
505 /// getWarningOptionForDiag - Return the lowest-level warning option that
506 /// enables the specified diagnostic. If there is no -Wfoo flag that controls
507 /// the diagnostic, this returns null.
508 StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) {
509 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
510 return OptionTable[Info->getOptionGroupIndex()].getName();
514 void DiagnosticIDs::getDiagnosticsInGroup(
515 const WarningOption *Group,
516 llvm::SmallVectorImpl<diag::kind> &Diags) const
518 // Add the members of the option diagnostic set.
519 if (const short *Member = Group->Members) {
520 for (; *Member != -1; ++Member)
521 Diags.push_back(*Member);
524 // Add the members of the subgroups.
525 if (const short *SubGroups = Group->SubGroups) {
526 for (; *SubGroups != (short)-1; ++SubGroups)
527 getDiagnosticsInGroup(&OptionTable[(short)*SubGroups], Diags);
531 bool DiagnosticIDs::getDiagnosticsInGroup(
533 llvm::SmallVectorImpl<diag::kind> &Diags) const
535 WarningOption Key = { Group.size(), Group.data(), 0, 0 };
536 const WarningOption *Found =
537 std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key,
538 WarningOptionCompare);
539 if (Found == OptionTable + OptionTableSize ||
540 Found->getName() != Group)
541 return true; // Option not found.
543 getDiagnosticsInGroup(Found, Diags);
547 void DiagnosticIDs::getAllDiagnostics(
548 llvm::SmallVectorImpl<diag::kind> &Diags) const {
549 for (unsigned i = 0; i != StaticDiagInfoSize; ++i)
550 Diags.push_back(StaticDiagInfo[i].DiagID);
553 StringRef DiagnosticIDs::getNearestWarningOption(StringRef Group) {
555 unsigned BestDistance = Group.size() + 1; // Sanity threshold.
556 for (const WarningOption *i = OptionTable, *e = OptionTable + OptionTableSize;
558 // Don't suggest ignored warning flags.
559 if (!i->Members && !i->SubGroups)
562 unsigned Distance = i->getName().edit_distance(Group, true, BestDistance);
563 if (Distance == BestDistance) {
564 // Two matches with the same distance, don't prefer one over the other.
566 } else if (Distance < BestDistance) {
567 // This is a better match.
569 BestDistance = Distance;
576 /// ProcessDiag - This is the method used to report a diagnostic that is
577 /// finally fully formed.
578 bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
579 Diagnostic Info(&Diag);
581 if (Diag.SuppressAllDiagnostics)
584 assert(Diag.getClient() && "DiagnosticClient not set!");
586 // Figure out the diagnostic level of this message.
587 unsigned DiagID = Info.getID();
588 DiagnosticIDs::Level DiagLevel
589 = getDiagnosticLevel(DiagID, Info.getLocation(), Diag);
591 if (DiagLevel != DiagnosticIDs::Note) {
592 // Record that a fatal error occurred only when we see a second
593 // non-note diagnostic. This allows notes to be attached to the
594 // fatal error, but suppresses any diagnostics that follow those
596 if (Diag.LastDiagLevel == DiagnosticIDs::Fatal)
597 Diag.FatalErrorOccurred = true;
599 Diag.LastDiagLevel = DiagLevel;
602 // Update counts for DiagnosticErrorTrap even if a fatal error occurred.
603 if (DiagLevel >= DiagnosticIDs::Error) {
604 ++Diag.TrapNumErrorsOccurred;
605 if (isUnrecoverable(DiagID))
606 ++Diag.TrapNumUnrecoverableErrorsOccurred;
609 // If a fatal error has already been emitted, silence all subsequent
611 if (Diag.FatalErrorOccurred) {
612 if (DiagLevel >= DiagnosticIDs::Error &&
613 Diag.Client->IncludeInDiagnosticCounts()) {
615 ++Diag.NumErrorsSuppressed;
621 // If the client doesn't care about this message, don't issue it. If this is
622 // a note and the last real diagnostic was ignored, ignore it too.
623 if (DiagLevel == DiagnosticIDs::Ignored ||
624 (DiagLevel == DiagnosticIDs::Note &&
625 Diag.LastDiagLevel == DiagnosticIDs::Ignored))
628 if (DiagLevel >= DiagnosticIDs::Error) {
629 if (isUnrecoverable(DiagID))
630 Diag.UnrecoverableErrorOccurred = true;
632 Diag.ErrorOccurred = true;
633 if (Diag.Client->IncludeInDiagnosticCounts()) {
637 // If we've emitted a lot of errors, emit a fatal error instead of it to
638 // stop a flood of bogus errors.
639 if (Diag.ErrorLimit && Diag.NumErrors > Diag.ErrorLimit &&
640 DiagLevel == DiagnosticIDs::Error) {
641 Diag.SetDelayedDiagnostic(diag::fatal_too_many_errors);
646 // Finally, report it.
647 EmitDiag(Diag, DiagLevel);
651 void DiagnosticIDs::EmitDiag(DiagnosticsEngine &Diag, Level DiagLevel) const {
652 Diagnostic Info(&Diag);
653 assert(DiagLevel != DiagnosticIDs::Ignored && "Cannot emit ignored diagnostics!");
655 Diag.Client->HandleDiagnostic((DiagnosticsEngine::Level)DiagLevel, Info);
656 if (Diag.Client->IncludeInDiagnosticCounts()) {
657 if (DiagLevel == DiagnosticIDs::Warning)
661 Diag.CurDiagID = ~0U;
664 bool DiagnosticIDs::isUnrecoverable(unsigned DiagID) const {
665 if (DiagID >= diag::DIAG_UPPER_LIMIT) {
666 // Custom diagnostics.
667 return CustomDiagInfo->getLevel(DiagID) >= DiagnosticIDs::Error;
670 // Only errors may be unrecoverable.
671 if (getBuiltinDiagClass(DiagID) < CLASS_ERROR)
674 if (DiagID == diag::err_unavailable ||
675 DiagID == diag::err_unavailable_message)
678 // Currently we consider all ARC errors as recoverable.
679 if (isARCDiagnostic(DiagID))
685 bool DiagnosticIDs::isARCDiagnostic(unsigned DiagID) {
686 unsigned cat = getCategoryNumberForDiag(DiagID);
687 return DiagnosticIDs::getCategoryNameFromID(cat).startswith("ARC ");