You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For header files that pass the -header-filter, the modernize-concat-nested-namespaces check does not generate the expected warning and fix for un-concatenated namespaces.
E.g.,
====a.h===
#pragma once
namespace foo {
namespace bar {
namespace baz {
struct S {};
}
}
}
Running the following command only generates fixes for a.cpp, not the instance in a.h:
clang-tidy -checks="modernize-concat-nested-namespaces" -p path/to/compilation_database.json -header-filter="a.h" -fix-errors a.cpp
If instead, I pass a.h as the last argument, clang-tidy does generate fixes for the header.
Extended Description
For header files that pass the -header-filter, the modernize-concat-nested-namespaces check does not generate the expected warning and fix for un-concatenated namespaces.
E.g.,
====a.h===
#pragma once
namespace foo {
namespace bar {
namespace baz {
struct S {};
}
}
}
====a.cpp====
#include "a.h"
namespace foo {
namespace bar {
namespace baz {
void foo(const S&) {}
}
}
}
int main () {
return 0;
}
Running the following command only generates fixes for a.cpp, not the instance in a.h:
clang-tidy -checks="modernize-concat-nested-namespaces" -p path/to/compilation_database.json -header-filter="a.h" -fix-errors a.cpp
If instead, I pass a.h as the last argument, clang-tidy does generate fixes for the header.
I suspect this is due to the early return here:
https://github.com/llvm-mirror/clang-tools-extra/blob/e5a800d6f7b093471c7bb509dfcc3713ef01caf8/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp#L88
Perhaps we should only return if the location is not in the main file and if it's not a header.
The text was updated successfully, but these errors were encountered: