Skip to content

[clang-tidy] misc-confusable-identifiers ignores -header-filter option #142112

Open
@ottml

Description

@ottml

When using the clang tidy check misc-confusable-identifiers the option -header-filter is ignored. The warnings from the files not matching the header-filter are always displayed and not suppressed. This works perfectly for the check google-explicit-constructor shown by the example below.

Ubuntu LLVM version 18.1.3

The problem can be reproduced by the following example:

main.cpp:

#include "header1.h"

namespace AI{
  const int val = 10;
}

int main(int c, char** v)
{
    return 0;
}

header1.h:

class A { A(int); };

namespace A1
{
void printi();
}

Output from clang-tidy with misc-confusable-identifiers:

clang-tidy-18 -checks='-*,misc-confusable-identifiers' -header-filter='ignore_all' main.cpp -p=../build/

1 warning generated.
/home/...../example/main/main.cpp:3:11: warning: 'AI' is confusable with 'A1' [misc-confusable-identifiers]
    3 | namespace AI{
      |           ^
/home/...../example/main/header1.h:3:11: note: other declaration found here
    3 | namespace A1
      |           ^

Output from clang-tidy with google-explicit-constructor:

clang-tidy-18 -checks='-*,google-explicit-constructor' -header-filter='ignore_all' m
ain.cpp -p=../build/

1 warning generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions