@@ -43,6 +43,7 @@ extern std::set<int> WarningIDs;
4343struct DiagnosticsMessage {
4444 int ID;
4545 int Category;
46+ EffortLevel EL;
4647 const char *Msg;
4748
4849#define DEF_WARNING (NAME, ID, LEVEL, MSG ) ID,
@@ -58,8 +59,8 @@ struct DiagnosticsMessage {
5859#undef DEF_COMMENT
5960 DiagnosticsMessage () = default ;
6061 DiagnosticsMessage (std::unordered_map<int , DiagnosticsMessage> &Table, int ID,
61- int Category, const char *Msg)
62- : ID(ID), Category(Category), Msg(Msg) {
62+ int Category, EffortLevel EL, const char *Msg)
63+ : ID(ID), Category(Category), EL(EL), Msg(Msg) {
6364 assert (Table.find (ID) == Table.end () && " [DPCT Internal error] Two "
6465 " messages with the same ID "
6566 " are being registered" );
@@ -317,12 +318,17 @@ inline bool report(SourceLocation SL, IDTy MsgID,
317318 if (checkDuplicated (FileAndLine, WarningIDAndMsg))
318319 return false ;
319320
321+ auto Diag = DiagnosticIDTable.find ((int )MsgID);
322+ if (Diag == DiagnosticIDTable.end ())
323+ return true ;
324+ if (DpctGlobalInfo::isAnalysisModeEnabled ()) {
325+ recordAnalysisModeEffort (SL, Diag->second .EL );
326+ return true ;
327+ }
320328 if (!SuppressWarningsAllFlag) {
321329 // Only report warnings that are not suppressed
322- if (WarningIDs.find ((int )MsgID) == WarningIDs.end () &&
323- DiagnosticIDTable.find ((int )MsgID) != DiagnosticIDTable.end ()) {
324- reportWarning (SL, DiagnosticIDTable[(int )MsgID], SM.getDiagnostics (),
325- Vals...);
330+ if (WarningIDs.find ((int )MsgID) == WarningIDs.end ()) {
331+ reportWarning (SL, Diag->second , SM.getDiagnostics (), Vals...);
326332 }
327333 }
328334 if (TS && CommentIDTable.find ((int )MsgID) != CommentIDTable.end ()) {
@@ -402,12 +408,17 @@ bool report(const clang::tooling::UnifiedPath &FileAbsPath, unsigned int Offset,
402408 unsigned int ColNum = Offset - Fileinfo->getLineInfo (LineNum).Offset + 1 ;
403409 SourceLocation SL = SM.translateLineCol (FID, LineNum, ColNum);
404410
411+ auto Diag = DiagnosticIDTable.find ((int )MsgID);
412+ if (Diag == DiagnosticIDTable.end ())
413+ return true ;
414+ if (DpctGlobalInfo::isAnalysisModeEnabled ()) {
415+ recordAnalysisModeEffort (FileAbsPath, Offset, Diag->second .EL );
416+ return true ;
417+ }
405418 if (!SuppressWarningsAllFlag) {
406419 // Only report warnings that are not suppressed
407- if (WarningIDs.find ((int )MsgID) == WarningIDs.end () &&
408- DiagnosticIDTable.find ((int )MsgID) != DiagnosticIDTable.end ()) {
409- reportWarning (SL, DiagnosticIDTable[(int )MsgID], SM.getDiagnostics (),
410- Vals...);
420+ if (WarningIDs.find ((int )MsgID) == WarningIDs.end ()) {
421+ reportWarning (SL, Diag->second , SM.getDiagnostics (), Vals...);
411422 }
412423 }
413424
0 commit comments