Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.
ClosedPublic

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

Details

Summary

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

Repository
rL LLVM
ygribov retitled this revision from to Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline..Dec 29 2015, 2:26 AM
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 added a comment.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.