Page MenuHomePhabricator

Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.

Authored by ygribov on Dec 29 2015, 2:26 AM.



This patch fixes assert "Unsortable locations found" when calling

PathDiagnosticLocation(SM.getSpellingLoc(E->getLocStart()), SM);

on an expression which comes from cmdline (i.e. macro defined with -D). Such expressions come from a special scratch buffer and thus trigger assert when passed to isBeforeInTranslationUnit.

Unfortunately this only reproduces on a local branch so I can not provide a minimal testcase. I hope the fix is self-evident though.

Diff Detail


Event Timeline

ygribov updated this revision to Diff 43724.Dec 29 2015, 2:26 AM
ygribov retitled this revision from to Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline..
ygribov updated this object.
ygribov added reviewers: doug.gregor, joerg.
ygribov set the repository for this revision to rL LLVM.
ygribov added subscribers: llvm-commits, a.sidorin.

Forgot to mention - no regressions in make check-all.

joerg edited edge metadata.Jan 27 2016, 5:40 AM

I'd prefer if the functional and cosmetic part of the patch was separated. The change looks reasonable otherwise.

This revision was automatically updated to reflect the committed changes.