简体   繁体   English

我怎么能告诉 clang-tidy 一次检查 pragma 而不是 llvm 风格的 header 警卫?

[英]How can I tell clang-tidy to check for pragma once instead of llvm-style header guards?

I would like to use clan-tidy.我想使用clan-tidy。 The program should check if I do have header guards, which is why I set the flag llvm-header-guard .程序应该检查我是否有 header 防护,这就是我设置标志llvm-header-guard原因。 Unfortunately this checks if the header guards are llvm-style , which I don't want.不幸的是,这会检查header 防护装置是否为 llvm-style ,这是我不想要的。 I want to use #pragma once .我想使用#pragma once

Does anyone have an idea how to tell clang-tidy to check for #pragma once instead of llvm-style header guards?有谁知道如何告诉 clang-tidy 检查#pragma once而不是 llvm 风格的 header 警卫?

There is no such check in clang-tidy. clang-tidy 中没有这样的检查。

#pragma once is not part of the C++ standard (for good reasons) and until it becomes a part of the standard there is no reason to add it to clang-tidy. #pragma once不是 C++ 标准的一部分(有充分的理由),在它成为标准的一部分之前,没有理由将其添加到 clang-tidy。

You can write your own check but I don't think it's worth the effort.你可以自己写支票,但我认为这不值得。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM