1 //===--- DiagnosticIDs.cpp - Diagnostic IDs Handling ----------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements the Diagnostic IDs-related interfaces. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "clang/AST/ASTDiagnostic.h" 15 #include "clang/Analysis/AnalysisDiagnostic.h" 16 #include "clang/Basic/DiagnosticIDs.h" 17 #include "clang/Basic/SourceManager.h" 18 #include "clang/Driver/DriverDiagnostic.h" 19 #include "clang/Frontend/FrontendDiagnostic.h" 20 #include "clang/Lex/LexDiagnostic.h" 21 #include "clang/Parse/ParseDiagnostic.h" 22 #include "clang/Sema/SemaDiagnostic.h" 23 24 #include <map> 25 using namespace clang; 26 27 //===----------------------------------------------------------------------===// 28 // Builtin Diagnostic information 29 //===----------------------------------------------------------------------===// 30 31 namespace { 32 33 // Diagnostic classes. 34 enum { 35 CLASS_NOTE = 0x01, 36 CLASS_WARNING = 0x02, 37 CLASS_EXTENSION = 0x03, 38 CLASS_ERROR = 0x04 39 }; 40 41 struct StaticDiagInfoRec { 42 unsigned short DiagID; 43 unsigned Mapping : 3; 44 unsigned Class : 3; 45 unsigned SFINAE : 1; 46 unsigned AccessControl : 1; 47 unsigned Category : 5; 48 49 const char *Description; 50 const char *OptionGroup; 51 52 bool operator<(const StaticDiagInfoRec &RHS) const { 53 return DiagID < RHS.DiagID; 54 } 55 }; 56 57 } 58 59 static const StaticDiagInfoRec StaticDiagInfo[] = { 60 #define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP,SFINAE,ACCESS,CATEGORY) \ 61 { diag::ENUM, DEFAULT_MAPPING, CLASS, SFINAE, ACCESS, CATEGORY, DESC, GROUP }, 62 #include "clang/Basic/DiagnosticCommonKinds.inc" 63 #include "clang/Basic/DiagnosticDriverKinds.inc" 64 #include "clang/Basic/DiagnosticFrontendKinds.inc" 65 #include "clang/Basic/DiagnosticLexKinds.inc" 66 #include "clang/Basic/DiagnosticParseKinds.inc" 67 #include "clang/Basic/DiagnosticASTKinds.inc" 68 #include "clang/Basic/DiagnosticSemaKinds.inc" 69 #include "clang/Basic/DiagnosticAnalysisKinds.inc" 70 { 0, 0, 0, 0, 0, 0, 0, 0} 71 }; 72 #undef DIAG 73 74 /// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID, 75 /// or null if the ID is invalid. 76 static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { 77 unsigned NumDiagEntries = sizeof(StaticDiagInfo)/sizeof(StaticDiagInfo[0])-1; 78 79 // If assertions are enabled, verify that the StaticDiagInfo array is sorted. 80 #ifndef NDEBUG 81 static bool IsFirst = true; 82 if (IsFirst) { 83 for (unsigned i = 1; i != NumDiagEntries; ++i) { 84 assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID && 85 "Diag ID conflict, the enums at the start of clang::diag (in " 86 "DiagnosticIDs.h) probably need to be increased"); 87 88 assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] && 89 "Improperly sorted diag info"); 90 } 91 IsFirst = false; 92 } 93 #endif 94 95 // Search the diagnostic table with a binary search. 96 StaticDiagInfoRec Find = { DiagID, 0, 0, 0, 0, 0, 0, 0 }; 97 98 const StaticDiagInfoRec *Found = 99 std::lower_bound(StaticDiagInfo, StaticDiagInfo + NumDiagEntries, Find); 100 if (Found == StaticDiagInfo + NumDiagEntries || 101 Found->DiagID != DiagID) 102 return 0; 103 104 return Found; 105 } 106 107 static unsigned GetDefaultDiagMapping(unsigned DiagID) { 108 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) 109 return Info->Mapping; 110 return diag::MAP_FATAL; 111 } 112 113 /// getWarningOptionForDiag - Return the lowest-level warning option that 114 /// enables the specified diagnostic. If there is no -Wfoo flag that controls 115 /// the diagnostic, this returns null. 116 const char *DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) { 117 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) 118 return Info->OptionGroup; 119 return 0; 120 } 121 122 /// getWarningOptionForDiag - Return the category number that a specified 123 /// DiagID belongs to, or 0 if no category. 124 unsigned DiagnosticIDs::getCategoryNumberForDiag(unsigned DiagID) { 125 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) 126 return Info->Category; 127 return 0; 128 } 129 130 /// getCategoryNameFromID - Given a category ID, return the name of the 131 /// category, an empty string if CategoryID is zero, or null if CategoryID is 132 /// invalid. 133 const char *DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { 134 // Second the table of options, sorted by name for fast binary lookup. 135 static const char *CategoryNameTable[] = { 136 #define GET_CATEGORY_TABLE 137 #define CATEGORY(X) X, 138 #include "clang/Basic/DiagnosticGroups.inc" 139 #undef GET_CATEGORY_TABLE 140 "<<END>>" 141 }; 142 static const size_t CategoryNameTableSize = 143 sizeof(CategoryNameTable) / sizeof(CategoryNameTable[0])-1; 144 145 if (CategoryID >= CategoryNameTableSize) return 0; 146 return CategoryNameTable[CategoryID]; 147 } 148 149 150 151 DiagnosticIDs::SFINAEResponse 152 DiagnosticIDs::getDiagnosticSFINAEResponse(unsigned DiagID) { 153 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) { 154 if (Info->AccessControl) 155 return SFINAE_AccessControl; 156 157 if (!Info->SFINAE) 158 return SFINAE_Report; 159 160 if (Info->Class == CLASS_ERROR) 161 return SFINAE_SubstitutionFailure; 162 163 // Suppress notes, warnings, and extensions; 164 return SFINAE_Suppress; 165 } 166 167 return SFINAE_Report; 168 } 169 170 /// getDiagClass - Return the class field of the diagnostic. 171 /// 172 static unsigned getBuiltinDiagClass(unsigned DiagID) { 173 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) 174 return Info->Class; 175 return ~0U; 176 } 177 178 //===----------------------------------------------------------------------===// 179 // Custom Diagnostic information 180 //===----------------------------------------------------------------------===// 181 182 namespace clang { 183 namespace diag { 184 class CustomDiagInfo { 185 typedef std::pair<DiagnosticIDs::Level, std::string> DiagDesc; 186 std::vector<DiagDesc> DiagInfo; 187 std::map<DiagDesc, unsigned> DiagIDs; 188 public: 189 190 /// getDescription - Return the description of the specified custom 191 /// diagnostic. 192 const char *getDescription(unsigned DiagID) const { 193 assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() && 194 "Invalid diagnosic ID"); 195 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second.c_str(); 196 } 197 198 /// getLevel - Return the level of the specified custom diagnostic. 199 DiagnosticIDs::Level getLevel(unsigned DiagID) const { 200 assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() && 201 "Invalid diagnosic ID"); 202 return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first; 203 } 204 205 unsigned getOrCreateDiagID(DiagnosticIDs::Level L, llvm::StringRef Message, 206 DiagnosticIDs &Diags) { 207 DiagDesc D(L, Message); 208 // Check to see if it already exists. 209 std::map<DiagDesc, unsigned>::iterator I = DiagIDs.lower_bound(D); 210 if (I != DiagIDs.end() && I->first == D) 211 return I->second; 212 213 // If not, assign a new ID. 214 unsigned ID = DiagInfo.size()+DIAG_UPPER_LIMIT; 215 DiagIDs.insert(std::make_pair(D, ID)); 216 DiagInfo.push_back(D); 217 return ID; 218 } 219 }; 220 221 } // end diag namespace 222 } // end clang namespace 223 224 225 //===----------------------------------------------------------------------===// 226 // Common Diagnostic implementation 227 //===----------------------------------------------------------------------===// 228 229 DiagnosticIDs::DiagnosticIDs() { 230 CustomDiagInfo = 0; 231 } 232 233 DiagnosticIDs::~DiagnosticIDs() { 234 delete CustomDiagInfo; 235 } 236 237 /// getCustomDiagID - Return an ID for a diagnostic with the specified message 238 /// and level. If this is the first request for this diagnosic, it is 239 /// registered and created, otherwise the existing ID is returned. 240 unsigned DiagnosticIDs::getCustomDiagID(Level L, llvm::StringRef Message) { 241 if (CustomDiagInfo == 0) 242 CustomDiagInfo = new diag::CustomDiagInfo(); 243 return CustomDiagInfo->getOrCreateDiagID(L, Message, *this); 244 } 245 246 247 /// isBuiltinWarningOrExtension - Return true if the unmapped diagnostic 248 /// level of the specified diagnostic ID is a Warning or Extension. 249 /// This only works on builtin diagnostics, not custom ones, and is not legal to 250 /// call on NOTEs. 251 bool DiagnosticIDs::isBuiltinWarningOrExtension(unsigned DiagID) { 252 return DiagID < diag::DIAG_UPPER_LIMIT && 253 getBuiltinDiagClass(DiagID) != CLASS_ERROR; 254 } 255 256 /// \brief Determine whether the given built-in diagnostic ID is a 257 /// Note. 258 bool DiagnosticIDs::isBuiltinNote(unsigned DiagID) { 259 return DiagID < diag::DIAG_UPPER_LIMIT && 260 getBuiltinDiagClass(DiagID) == CLASS_NOTE; 261 } 262 263 /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic 264 /// ID is for an extension of some sort. This also returns EnabledByDefault, 265 /// which is set to indicate whether the diagnostic is ignored by default (in 266 /// which case -pedantic enables it) or treated as a warning/error by default. 267 /// 268 bool DiagnosticIDs::isBuiltinExtensionDiag(unsigned DiagID, 269 bool &EnabledByDefault) { 270 if (DiagID >= diag::DIAG_UPPER_LIMIT || 271 getBuiltinDiagClass(DiagID) != CLASS_EXTENSION) 272 return false; 273 274 EnabledByDefault = GetDefaultDiagMapping(DiagID) != diag::MAP_IGNORE; 275 return true; 276 } 277 278 /// getDescription - Given a diagnostic ID, return a description of the 279 /// issue. 280 const char *DiagnosticIDs::getDescription(unsigned DiagID) const { 281 if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID)) 282 return Info->Description; 283 return CustomDiagInfo->getDescription(DiagID); 284 } 285 286 /// getDiagnosticLevel - Based on the way the client configured the Diagnostic 287 /// object, classify the specified diagnostic ID into a Level, consumable by 288 /// the DiagnosticClient. 289 DiagnosticIDs::Level 290 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, 291 const Diagnostic &Diag, 292 diag::Mapping *mapping) const { 293 // Handle custom diagnostics, which cannot be mapped. 294 if (DiagID >= diag::DIAG_UPPER_LIMIT) 295 return CustomDiagInfo->getLevel(DiagID); 296 297 unsigned DiagClass = getBuiltinDiagClass(DiagID); 298 assert(DiagClass != CLASS_NOTE && "Cannot get diagnostic level of a note!"); 299 return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag, mapping); 300 } 301 302 /// \brief Based on the way the client configured the Diagnostic 303 /// object, classify the specified diagnostic ID into a Level, consumable by 304 /// the DiagnosticClient. 305 /// 306 /// \param Loc The source location we are interested in finding out the 307 /// diagnostic state. Can be null in order to query the latest state. 308 DiagnosticIDs::Level 309 DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, 310 SourceLocation Loc, 311 const Diagnostic &Diag, 312 diag::Mapping *mapping) const { 313 // Specific non-error diagnostics may be mapped to various levels from ignored 314 // to error. Errors can only be mapped to fatal. 315 DiagnosticIDs::Level Result = DiagnosticIDs::Fatal; 316 317 Diagnostic::DiagStatePointsTy::iterator 318 Pos = Diag.GetDiagStatePointForLoc(Loc); 319 Diagnostic::DiagState *State = Pos->State; 320 321 // Get the mapping information, if unset, compute it lazily. 322 unsigned MappingInfo = Diag.getDiagnosticMappingInfo((diag::kind)DiagID, 323 State); 324 if (MappingInfo == 0) { 325 MappingInfo = GetDefaultDiagMapping(DiagID); 326 Diag.setDiagnosticMappingInternal(DiagID, MappingInfo, State, false, false); 327 } 328 329 if (mapping) 330 *mapping = (diag::Mapping) (MappingInfo & 7); 331 332 switch (MappingInfo & 7) { 333 default: assert(0 && "Unknown mapping!"); 334 case diag::MAP_IGNORE: 335 // Ignore this, unless this is an extension diagnostic and we're mapping 336 // them onto warnings or errors. 337 if (!isBuiltinExtensionDiag(DiagID) || // Not an extension 338 Diag.ExtBehavior == Diagnostic::Ext_Ignore || // Ext ignored 339 (MappingInfo & 8) != 0) // User explicitly mapped it. 340 return DiagnosticIDs::Ignored; 341 Result = DiagnosticIDs::Warning; 342 if (Diag.ExtBehavior == Diagnostic::Ext_Error) Result = DiagnosticIDs::Error; 343 if (Result == DiagnosticIDs::Error && Diag.ErrorsAsFatal) 344 Result = DiagnosticIDs::Fatal; 345 break; 346 case diag::MAP_ERROR: 347 Result = DiagnosticIDs::Error; 348 if (Diag.ErrorsAsFatal) 349 Result = DiagnosticIDs::Fatal; 350 break; 351 case diag::MAP_FATAL: 352 Result = DiagnosticIDs::Fatal; 353 break; 354 case diag::MAP_WARNING: 355 // If warnings are globally mapped to ignore or error, do it. 356 if (Diag.IgnoreAllWarnings) 357 return DiagnosticIDs::Ignored; 358 359 Result = DiagnosticIDs::Warning; 360 361 // If this is an extension diagnostic and we're in -pedantic-error mode, and 362 // if the user didn't explicitly map it, upgrade to an error. 363 if (Diag.ExtBehavior == Diagnostic::Ext_Error && 364 (MappingInfo & 8) == 0 && 365 isBuiltinExtensionDiag(DiagID)) 366 Result = DiagnosticIDs::Error; 367 368 if (Diag.WarningsAsErrors) 369 Result = DiagnosticIDs::Error; 370 if (Result == DiagnosticIDs::Error && Diag.ErrorsAsFatal) 371 Result = DiagnosticIDs::Fatal; 372 break; 373 374 case diag::MAP_WARNING_NO_WERROR: 375 // Diagnostics specified with -Wno-error=foo should be set to warnings, but 376 // not be adjusted by -Werror or -pedantic-errors. 377 Result = DiagnosticIDs::Warning; 378 379 // If warnings are globally mapped to ignore or error, do it. 380 if (Diag.IgnoreAllWarnings) 381 return DiagnosticIDs::Ignored; 382 383 break; 384 385 case diag::MAP_ERROR_NO_WFATAL: 386 // Diagnostics specified as -Wno-fatal-error=foo should be errors, but 387 // unaffected by -Wfatal-errors. 388 Result = DiagnosticIDs::Error; 389 break; 390 } 391 392 // Okay, we're about to return this as a "diagnostic to emit" one last check: 393 // if this is any sort of extension warning, and if we're in an __extension__ 394 // block, silence it. 395 if (Diag.AllExtensionsSilenced && isBuiltinExtensionDiag(DiagID)) 396 return DiagnosticIDs::Ignored; 397 398 return Result; 399 } 400 401 struct WarningOption { 402 const char *Name; 403 const short *Members; 404 const short *SubGroups; 405 }; 406 407 #define GET_DIAG_ARRAYS 408 #include "clang/Basic/DiagnosticGroups.inc" 409 #undef GET_DIAG_ARRAYS 410 411 // Second the table of options, sorted by name for fast binary lookup. 412 static const WarningOption OptionTable[] = { 413 #define GET_DIAG_TABLE 414 #include "clang/Basic/DiagnosticGroups.inc" 415 #undef GET_DIAG_TABLE 416 }; 417 static const size_t OptionTableSize = 418 sizeof(OptionTable) / sizeof(OptionTable[0]); 419 420 static bool WarningOptionCompare(const WarningOption &LHS, 421 const WarningOption &RHS) { 422 return strcmp(LHS.Name, RHS.Name) < 0; 423 } 424 425 static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping, 426 SourceLocation Loc, Diagnostic &Diag) { 427 // Option exists, poke all the members of its diagnostic set. 428 if (const short *Member = Group->Members) { 429 for (; *Member != -1; ++Member) 430 Diag.setDiagnosticMapping(*Member, Mapping, Loc); 431 } 432 433 // Enable/disable all subgroups along with this one. 434 if (const short *SubGroups = Group->SubGroups) { 435 for (; *SubGroups != (short)-1; ++SubGroups) 436 MapGroupMembers(&OptionTable[(short)*SubGroups], Mapping, Loc, Diag); 437 } 438 } 439 440 /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g. 441 /// "unknown-pragmas" to have the specified mapping. This returns true and 442 /// ignores the request if "Group" was unknown, false otherwise. 443 bool DiagnosticIDs::setDiagnosticGroupMapping(const char *Group, 444 diag::Mapping Map, 445 SourceLocation Loc, 446 Diagnostic &Diag) const { 447 assert((Loc.isValid() || 448 Diag.DiagStatePoints.empty() || 449 Diag.DiagStatePoints.back().Loc.isInvalid()) && 450 "Loc should be invalid only when the mapping comes from command-line"); 451 assert((Loc.isInvalid() || Diag.DiagStatePoints.empty() || 452 Diag.DiagStatePoints.back().Loc.isInvalid() || 453 !Diag.SourceMgr->isBeforeInTranslationUnit(Loc, 454 Diag.DiagStatePoints.back().Loc)) && 455 "Source location of new mapping is before the previous one!"); 456 457 WarningOption Key = { Group, 0, 0 }; 458 const WarningOption *Found = 459 std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key, 460 WarningOptionCompare); 461 if (Found == OptionTable + OptionTableSize || 462 strcmp(Found->Name, Group) != 0) 463 return true; // Option not found. 464 465 MapGroupMembers(Found, Map, Loc, Diag); 466 return false; 467 } 468 469 /// ProcessDiag - This is the method used to report a diagnostic that is 470 /// finally fully formed. 471 bool DiagnosticIDs::ProcessDiag(Diagnostic &Diag) const { 472 DiagnosticInfo Info(&Diag); 473 474 if (Diag.SuppressAllDiagnostics) 475 return false; 476 477 assert(Diag.getClient() && "DiagnosticClient not set!"); 478 479 // Figure out the diagnostic level of this message. 480 DiagnosticIDs::Level DiagLevel; 481 unsigned DiagID = Info.getID(); 482 483 // ShouldEmitInSystemHeader - True if this diagnostic should be produced even 484 // in a system header. 485 bool ShouldEmitInSystemHeader; 486 487 if (DiagID >= diag::DIAG_UPPER_LIMIT) { 488 // Handle custom diagnostics, which cannot be mapped. 489 DiagLevel = CustomDiagInfo->getLevel(DiagID); 490 491 // Custom diagnostics always are emitted in system headers. 492 ShouldEmitInSystemHeader = true; 493 } else { 494 // Get the class of the diagnostic. If this is a NOTE, map it onto whatever 495 // the diagnostic level was for the previous diagnostic so that it is 496 // filtered the same as the previous diagnostic. 497 unsigned DiagClass = getBuiltinDiagClass(DiagID); 498 if (DiagClass == CLASS_NOTE) { 499 DiagLevel = DiagnosticIDs::Note; 500 ShouldEmitInSystemHeader = false; // extra consideration is needed 501 } else { 502 // If this is not an error and we are in a system header, we ignore it. 503 // Check the original Diag ID here, because we also want to ignore 504 // extensions and warnings in -Werror and -pedantic-errors modes, which 505 // *map* warnings/extensions to errors. 506 ShouldEmitInSystemHeader = DiagClass == CLASS_ERROR; 507 508 DiagLevel = getDiagnosticLevel(DiagID, DiagClass, Info.getLocation(), 509 Diag); 510 } 511 } 512 513 if (DiagLevel != DiagnosticIDs::Note) { 514 // Record that a fatal error occurred only when we see a second 515 // non-note diagnostic. This allows notes to be attached to the 516 // fatal error, but suppresses any diagnostics that follow those 517 // notes. 518 if (Diag.LastDiagLevel == DiagnosticIDs::Fatal) 519 Diag.FatalErrorOccurred = true; 520 521 Diag.LastDiagLevel = DiagLevel; 522 } 523 524 // If a fatal error has already been emitted, silence all subsequent 525 // diagnostics. 526 if (Diag.FatalErrorOccurred) { 527 if (DiagLevel >= DiagnosticIDs::Error && 528 Diag.Client->IncludeInDiagnosticCounts()) { 529 ++Diag.NumErrors; 530 ++Diag.NumErrorsSuppressed; 531 } 532 533 return false; 534 } 535 536 // If the client doesn't care about this message, don't issue it. If this is 537 // a note and the last real diagnostic was ignored, ignore it too. 538 if (DiagLevel == DiagnosticIDs::Ignored || 539 (DiagLevel == DiagnosticIDs::Note && 540 Diag.LastDiagLevel == DiagnosticIDs::Ignored)) 541 return false; 542 543 // If this diagnostic is in a system header and is not a clang error, suppress 544 // it. 545 if (Diag.SuppressSystemWarnings && !ShouldEmitInSystemHeader && 546 Info.getLocation().isValid() && 547 Diag.getSourceManager().isInSystemHeader( 548 Diag.getSourceManager().getInstantiationLoc(Info.getLocation())) && 549 (DiagLevel != DiagnosticIDs::Note || 550 Diag.LastDiagLevel == DiagnosticIDs::Ignored)) { 551 Diag.LastDiagLevel = DiagnosticIDs::Ignored; 552 return false; 553 } 554 555 if (DiagLevel >= DiagnosticIDs::Error) { 556 if (Diag.Client->IncludeInDiagnosticCounts()) { 557 Diag.ErrorOccurred = true; 558 ++Diag.NumErrors; 559 } 560 561 // If we've emitted a lot of errors, emit a fatal error after it to stop a 562 // flood of bogus errors. 563 if (Diag.ErrorLimit && Diag.NumErrors >= Diag.ErrorLimit && 564 DiagLevel == DiagnosticIDs::Error) 565 Diag.SetDelayedDiagnostic(diag::fatal_too_many_errors); 566 } 567 568 // If we have any Fix-Its, make sure that all of the Fix-Its point into 569 // source locations that aren't macro instantiations. If any point into 570 // macro instantiations, remove all of the Fix-Its. 571 for (unsigned I = 0, N = Diag.NumFixItHints; I != N; ++I) { 572 const FixItHint &FixIt = Diag.FixItHints[I]; 573 if (FixIt.RemoveRange.isInvalid() || 574 FixIt.RemoveRange.getBegin().isMacroID() || 575 FixIt.RemoveRange.getEnd().isMacroID()) { 576 Diag.NumFixItHints = 0; 577 break; 578 } 579 } 580 581 // Finally, report it. 582 Diag.Client->HandleDiagnostic((Diagnostic::Level)DiagLevel, Info); 583 if (Diag.Client->IncludeInDiagnosticCounts()) { 584 if (DiagLevel == DiagnosticIDs::Warning) 585 ++Diag.NumWarnings; 586 } 587 588 Diag.CurDiagID = ~0U; 589 590 return true; 591 } 592