Drop the relative-path branch; compile databases record absolute paths

This commit is contained in:
J. Nick Koston
2026-08-27 12:37:01 -05:00
parent c6b1a41e76
commit e56edc4af0
+1 -13
View File
@@ -212,18 +212,6 @@ _PCH_STRIP_FLAGS_WITH_ARG = frozenset({"-o", "-c", "-MT", "-MF", "-MQ"})
_PCH_STRIP_FLAGS = frozenset({"-MD", "-MMD", "-MP", "-MM", "-M"})
def _db_source_path(entry: dict, build_dir: Path) -> Path:
"""A compile database entry's source file as a resolved absolute path."""
path = Path(entry["file"])
if not path.is_absolute():
directory = entry.get("directory")
base = (
Path(directory) if isinstance(directory, str) and directory else build_dir
)
path = base / path
return path.resolve()
def pch_compile_command(
build_dir: Path, header: Path, gch: Path
) -> tuple[list[str], Path] | None:
@@ -254,7 +242,7 @@ def pch_compile_command(
if isinstance(e, dict)
and isinstance(e.get("file"), str)
and e["file"].endswith(CXX_SOURCE_SUFFIXES)
and _db_source_path(e, build_dir).is_relative_to(src_root)
and Path(e["file"]).resolve().is_relative_to(src_root)
),
None,
)