Clang-Tidy 更改 c 文件的签名,但不更改关联的 header
Clang-Tidy changes signature of c file, but not the associated header
我有这个c文件
#include "pointer.h"
int switcher(int * i) {
int a = *i;
switch (a) {
case 1:
return 0;
default:
return 1;
}
}
并且关联的 header 仅包含一行
int switcher(int * i);
这是使用 clang 编译的。
如果我现在使用 clang-tidy (clang-tidy -fix pointer.c -checks=* -header-filter=.* ) 我会得到以下结果
#include "pointer.h"
int switcher(const int * i) {
int a = *i;
switch (a) {
case 1:
return 0;
default:
return 1;
}
}
和header
#ifndef _HOME_GWE_PROJEKTE_CLANG_TIDY_POINTER_H
#define _HOME_GWE_PROJEKTE_CLANG_TIDY_POINTER_H
int switcher(int * i);
#endif
函数的签名已从 (int i) 更改为 (const inti),这很好。 header 文件也被更改(守卫),但签名保持不变。因此。代码不再编译。
我的compile_commands.json看起来像这样
[
{
"directory": "/home/gwe/projekte/clang/tidy",
"command": "clang -c pointer.c -I.",
"file": "pointer.c"
}
]
这是 clang-tidy 错误还是我做错了?
感谢您的帮助?
此致,格奥尔格
此错误已报告给 llvm.org。
bugs.llvm.org//show_bug.cgi?id=33219
我有这个c文件
#include "pointer.h"
int switcher(int * i) {
int a = *i;
switch (a) {
case 1:
return 0;
default:
return 1;
}
}
并且关联的 header 仅包含一行
int switcher(int * i);
这是使用 clang 编译的。
如果我现在使用 clang-tidy (clang-tidy -fix pointer.c -checks=* -header-filter=.* ) 我会得到以下结果
#include "pointer.h"
int switcher(const int * i) {
int a = *i;
switch (a) {
case 1:
return 0;
default:
return 1;
}
}
和header
#ifndef _HOME_GWE_PROJEKTE_CLANG_TIDY_POINTER_H
#define _HOME_GWE_PROJEKTE_CLANG_TIDY_POINTER_H
int switcher(int * i);
#endif
函数的签名已从 (int i) 更改为 (const inti),这很好。 header 文件也被更改(守卫),但签名保持不变。因此。代码不再编译。
我的compile_commands.json看起来像这样
[
{
"directory": "/home/gwe/projekte/clang/tidy",
"command": "clang -c pointer.c -I.",
"file": "pointer.c"
}
]
这是 clang-tidy 错误还是我做错了? 感谢您的帮助?
此致,格奥尔格
此错误已报告给 llvm.org。
bugs.llvm.org//show_bug.cgi?id=33219