[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

Christof Douma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 8 09:46:22 PDT 2017


christof added a comment.

@rnk can you let me know if you are happy with the changes?
@rovka I assume the rebase did not change your mind about the patch. But please let me know if you have new reservations.

Thanks



================
Comment at: lib/Frontend/DiagnosticRenderer.cpp:512
   // Produce a stack of macro backtraces.
-  SmallVector<SourceLocation, 8> LocationStack;
+  SmallVector<FullSourceLoc, 8> LocationStack;
   unsigned IgnoredEnd = 0;
----------------
sanwou01 wrote:
> rnk wrote:
> > This seems inefficient, it wastes space on `SourceManager` pointers that will all be the same.
> True, but it does make the rest of this function more readable. I'd prefer to leave it as is. Maybe just reducing the SmallVector size to, say, 4, to take up less stack space?
We indeed waste that space, but it is 8 times a pointer while we printing diagnostics. I don't think that this inefficiency is is of any concern, especially not considering the amount of buffering that goes on during printing anyway.


https://reviews.llvm.org/D31709





More information about the cfe-commits mailing list