[cfe-commits] r157659 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaChecking.cpp test/SemaCXX/warn-memset-bad-sizeof-fixit.cpp
Chandler Carruth
chandlerc at google.com
Tue May 29 18:24:18 PDT 2012
On Tue, May 29, 2012 at 5:34 PM, Anna Zaks <ganna at apple.com> wrote:
> + // If the function is defined as a builtin macro, do not show
> macro
> + // expansion.
> + SourceLocation SL = SizeOfArg->getExprLoc();
> + SourceRange DSR = Dest->getSourceRange();
> + SourceRange SSR = SizeOfArg->getSourceRange();
> + SourceManager &SM = PP.getSourceManager();
> +
> + if (SM.isMacroArgExpansion(SL)) {
> + ReadableName = Lexer::getImmediateMacroName(SL, SM, LangOpts);
> + SL = SM.getSpellingLoc(SL);
> + DSR = SourceRange(SM.getSpellingLoc(DSR.getBegin()),
> + SM.getSpellingLoc(DSR.getEnd()));
> + SSR = SourceRange(SM.getSpellingLoc(SSR.getBegin()),
> + SM.getSpellingLoc(SSR.getEnd()));
> + }
>
I'm not terribly fond of this kind of highly customized printing logic when
we may not even emit the diagnostic.
I wonder -- can we construct this information from within the diagnostic
printer, and get it to fire in more circumstances? If not, is there a way
to simply tell the diagnostic engine the intent -- to print the builtin
name -- rather than hard coding the logic to get from here to there?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120529/94dad628/attachment.html>
More information about the cfe-commits
mailing list