[clang] [clang-tools-extra] [Clang] [Diagnostics] Simplify filenames that contain '..' (PR #143520)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 12 09:05:52 PDT 2025


Sirraide wrote:

> my worry about ill-effects from canonicalization of the user's build-dir-relative file paths into absolute paths is a more general one

Yeah, and moreover, another point I just thought of is that users tend to have more control over their own include directories, i.e. if you don’t want your paths to be printed w/ `..`, then just don’t use relative includes and add the directories you’re including from to the include path. But when it comes to the standard library, users don’t get a choice because we have those paths hard-coded as relative paths. So doing this *only* for standard library include paths sgtm.

More specifically, my idea now is to canonicalise all paths added via `-include-isystem` (unless `-no-canonical-prefix` is specified) since 
1. there are a *lot* of places in which we create relative paths to standard library headers, and doing canonicalisation where we first compose those paths would require doing that in dozens of places; from what I can tell though, we consistently use `-include-isystem` (or a variant of it for C headers iirc) for all of them, and
2. `-include-isystem` is not supposed to be a user-facing flag anyway (I think it’s only supported as a cc1 option?), so if you’re using that as a user then you get what you get imo.

https://github.com/llvm/llvm-project/pull/143520


More information about the cfe-commits mailing list