Skip to content

[clang-scan-deps] [P1689] Inconsistent path style for make style dependency output #69439

@ChuanqiXu9

Description

@ChuanqiXu9

Reproducer:

// a.h
// empty 

// a.cpp
#include "a.h"
#include <stdarg.h>

Use the following command to get the make style dependency information:

clang-scan-deps -format=p1689  -- <abs-path>/clang++  -std=c++20 a.cpp -c -o a.o -MD -MT a.ddi -MF a.dep
cat a.dep

we get:

a.ddi: \
  <absolute-path>/a.cpp \
  <absolute-path>/a.h \
  <absolute-path>/stdarg.h \
  <absolute-path>/__stdarg___gnuc_va_list.h \
  <absolute-path>/__stdarg_va_list.h \
  <absolute-path>/__stdarg_va_arg.h \
  <absolute-path>/__stdarg___va_copy.h \
  <absolute-path>/__stdarg_va_copy.h

But if we try to get the information by the compiler itself:

a.ddi: a.cpp a.h \
  <absolute-path>/stdarg.h \
  <absolute-path>/__stdarg___gnuc_va_list.h \
  <absolute-path>/__stdarg_va_list.h \
  <absolute-path>/__stdarg_va_arg.h \
  <absolute-path>/__stdarg___va_copy.h \
  <absolute-path>/__stdarg_va_copy.h

then we can find that the path to a.cpp and a.h is not consistency. This is problematic in cases like sandboxes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions