Skip to content

clang-scan-deps: macro is not handled correctly  #92357

Closed
@RichardLuo0

Description

@RichardLuo0
#define STD import std;
STD;

int main() {
    std::cout << 1 <<std::endl;
}

This file will compile, but clang-scan-deps gives:

{
  "revision": 0,
  "rules": [
    {
      "primary-output": "test"
    }
  ],
  "version": 1
}

The command is clang-scan-deps.exe -format=p1689 -- clang++.exe -fansi-escape-codes -fcolor-diagnostics -c -march=native -std=c++20 -Wall main.cpp -o test

But if I change to

#define STD std;
import STD;

int main() {
    std::cout << 1 <<std::endl;
}

Now it gives the correct output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tools-extraquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions