Search code examples
llvm-clang

Is there any method support in clang which helps to get "fall through" cases?


I want to get the fall through cases while traversing through the AST. Is there any method clang provides which i can use to get the "fallThrough" cases. For example:

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();
  }
}

Solution

  • After search in the internet i found the solution in clang developers archive. http://clang-developers.42468.n3.nabble.com/check-whether-a-case-statement-has-a-break-statement-td4029282.html#a4029357

    It was wonderful learning about how clang diagnostic works. :)