This revision was automatically updated to reflect the committed changes.
Closed by commit rGa21a46205165: Make the diagnostic-missing-prototypes put the
suggested `static` in front of… (authored by oontvoo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
oontvoo updated this revision to Diff 269657.
oontvoo marked an inline comment as done.
oontvoo added a comment.
Address review comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81444/new/
https://reviews.llvm.org/D81444
Files:
oontvoo marked 7 inline comments as done.
oontvoo added inline comments.
Comment at: clang/test/Sema/warn-missing-prototypes.c:62
+
+const struct MyStruct get_struct() { // expected-warning{{no previous
prototype for function 'get_struct'}}
+
gribozavr2 added inline comments.
Comment at: clang/lib/Lex/Lexer.cpp:1302
+bool Lexer::isConst(SourceLocation Loc, const SourceManager ,
+const LangOptions ) {
I'm concerned about putting this API into Lexer, given this implementation. It
oontvoo updated this revision to Diff 269627.
oontvoo marked an inline comment as done.
oontvoo added a comment.
- Less brittle way to find the loc of const.
- Add more tests
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81444/new/
oontvoo marked an inline comment as done.
oontvoo added inline comments.
Comment at: clang/lib/Sema/SemaDecl.cpp:14252
+ FD->getReturnType().isConstQualified())
+return FD->getReturnTypeSourceRange().getBegin().getLocWithOffset(
+
gribozavr2 added inline comments.
Comment at: clang/lib/Sema/SemaDecl.cpp:14252
+ FD->getReturnType().isConstQualified())
+return FD->getReturnTypeSourceRange().getBegin().getLocWithOffset(
+/*strlen("const ")=*/-6);
oontvoo created this revision.
oontvoo added a reviewer: gribozavr2.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Consider: `const int* get_foo() {return nullptr;}`
The suggested fix should be `static const int* get_foo(){}`
and not `const static int* get_foo(){}`