@@ -103,6 +103,13 @@ class Tokenizer: public ITokenizer {
103103 RE (" ^(?<file>[^:]+):(?<line>[0-9]+)() " /* file:line */
104104 RE_FNC_SMATCH /* fnc */
105105 " ([a-z]+): (.*)$" ) /* evt: msg */ ;
106+
107+ const RE reUbsanScope_ =
108+ RE (" ^\\ s*#\\ d+ (0x[[:xdigit:]]+) in ([^ ]+) " /* address, fnc */
109+ /* file:line OR executable+address */
110+ " (?:(?<file>[^:]+):(?<line>[0-9]+)|\\ ((?<file>[^+]+)\\ +(?<line>0x[[:xdigit:]]+)\\ ))"
111+ /* BuildId */
112+ " (?: \\ (BuildId: [[:xdigit:]]+\\ ))?$" );
106113};
107114
108115EToken Tokenizer::readNext (DefEvent *pEvt)
@@ -158,6 +165,11 @@ EToken Tokenizer::readNext(DefEvent *pEvt)
158165 pEvt->msg = sm[/* fnc */ 4 ] + " (): " ;
159166 pEvt->msg += sm[/* msg */ 6 ];
160167 }
168+ else if (boost::regex_match (line, sm, reUbsanScope_)) {
169+ tok = T_MSG;
170+ pEvt->event = " note" ;
171+ pEvt->msg = sm[/* fnc */ 2 ] + " () at " + sm[/* address */ 1 ];
172+ }
161173 else
162174 return T_UNKNOWN;
163175
@@ -570,6 +582,7 @@ struct GccPostProcessor::Private {
570582 const ImpliedAttrDigger digger;
571583
572584 void transGccAnal (Defect *pDef) const ;
585+ void transUbsan (Defect *pDef) const ;
573586 void polishGccAnal (Defect *pDef) const ;
574587 void polishClangAnal (Defect *pDef) const ;
575588 void transSuffixGeneric (Defect *pDef, const std::string, const RE &) const ;
@@ -619,6 +632,17 @@ void GccPostProcessor::Private::transGccAnal(Defect *pDef) const
619632 keyEvt.msg = sm[/* msg */ 1 ];
620633}
621634
635+ void GccPostProcessor::Private::transUbsan (Defect *pDef) const
636+ {
637+ if (" COMPILER_WARNING" != pDef->checker )
638+ return ;
639+
640+ // UBSAN always uses 'runtime error' for its key event
641+ DefEvent &keyEvt = pDef->events [pDef->keyEventIdx ];
642+ if (keyEvt.event == " runtime error" )
643+ pDef->checker = " UBSAN_WARNING" ;
644+ }
645+
622646void GccPostProcessor::Private::polishGccAnal (Defect *pDef) const
623647{
624648 if (" GCC_ANALYZER_WARNING" != pDef->checker )
@@ -677,6 +701,7 @@ void GccPostProcessor::Private::transSuffixGeneric(
677701void GccPostProcessor::apply (Defect *pDef) const
678702{
679703 d->transGccAnal (pDef);
704+ d->transUbsan (pDef);
680705 d->transSuffixGeneric (pDef, " CLANG_WARNING" , d->reClangWarningEvt );
681706 d->transSuffixGeneric (pDef, " COMPILER_WARNING" , d->reGccWarningEvt );
682707 d->transSuffixGeneric (pDef, " SHELLCHECK_WARNING" , d->reShellCheckId );
0 commit comments