llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.93k stars 11.53k forks source link

[enhancement] clang-modernize should support converting K&R parameter definitions into C prototypes #19231

Open llvmbot opened 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 18857
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @tetsuo-cpp,@EugeneZelenko,@LegalizeAdulthood

Extended Description

Example: convert:

/ a.h: / void f();

struct A { int m; };

/ a.c: / void f(x,p) int x; struct A *p; {

}

.... to:

/ a.h: / struct A; void f( int x, struct A *p );

struct A { int m; };

/ a.c: / void f( int x, struct A *p ); {

}

Notice that clang-modernize would have to insert a forward-declaration of struct A before the first use of "ptr-to-A" as a function parameter. (Otherwise, the type would belong to the scope of function parameters.)

EugeneZelenko commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#26466

EugeneZelenko commented 8 years ago

Bug llvm/llvm-bugzilla-archive#26466 has been marked as a duplicate of this bug.

EugeneZelenko commented 9 years ago

Clang-modernize is deprecated in favour of Clang-tidy modernize module.

GCC had (or still has) protoize which fix function declarations.

llvmbot commented 10 years ago

assigned to @tetsuo-cpp

llvmbot commented 1 year ago

@llvm/issue-subscribers-c