clang 中是否有任何方法支持有助于获得 "fall through" 个案例?
Is there any method support in clang which helps to get "fall through" cases?
我想在遍历 AST 的同时通过 case 来解决问题。是否有任何方法 clang 提供我可以用来获取 "fallThrough" 个案例。
例如:
void f(int n) {
void g(), h(), i();
switch (n) {
case 1:
case 2:
g(); // This is the one of the case of "fall through"
case 3:
h();
}
}
在网上搜索后,我在 clang developers archive 中找到了解决方案。
http://clang-developers.42468.n3.nabble.com/check-whether-a-case-statement-has-a-break-statement-td4029282.html#a4029357
了解 clang 诊断的工作原理真是太棒了。 :)
我想在遍历 AST 的同时通过 case 来解决问题。是否有任何方法 clang 提供我可以用来获取 "fallThrough" 个案例。 例如:
void f(int n) {
void g(), h(), i();
switch (n) {
case 1:
case 2:
g(); // This is the one of the case of "fall through"
case 3:
h();
}
}
在网上搜索后,我在 clang developers archive 中找到了解决方案。 http://clang-developers.42468.n3.nabble.com/check-whether-a-case-statement-has-a-break-statement-td4029282.html#a4029357
了解 clang 诊断的工作原理真是太棒了。 :)