[PATCH] D33676: Place implictly declared functions at block scope

2017-08-10 Thread Momchil Velikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL310616: Place implictly declared functions at block scope (authored by chill). Changed prior to commit: https://reviews.llvm.org/D33676?vs=109366=110587#toc Repository: rL LLVM

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-02 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Thanks for the review, I'll wait a few days. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-02 Thread Momchil Velikov via Phabricator via cfe-commits
chill updated this revision to Diff 109366. chill added a comment. Updated with only whitespace changes after formating each changed line with clang-format. https://reviews.llvm.org/D33676 Files: include/clang/Sema/Scope.h lib/Parse/ParseCXXInlineMethods.cpp lib/Parse/ParseDecl.cpp

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. This looks reasonable to me, once it's been formatted. Let's give @rsmith a few days to comment before committing, though. https://reviews.llvm.org/D33676

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-02 Thread Momchil Velikov via Phabricator via cfe-commits
chill added inline comments. Comment at: lib/Parse/ParseCXXInlineMethods.cpp:521-522 // to be re-used for method bodies as well. - ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope); + ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope| +

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/Parse/ParseCXXInlineMethods.cpp:521-522 // to be re-used for method bodies as well. - ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope); + ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope| +

[PATCH] D33676: Place implictly declared functions at block scope

2017-08-01 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Ping. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-25 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Ping. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-18 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Ping. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-11 Thread Momchil Velikov via Phabricator via cfe-commits
chill updated this revision to Diff 106056. chill added a comment. Herald added a subscriber: eraman. Set the compound statement flag on all compound statement scopes (previous version used to set the flag on just enough scopes as to be sufficient for the purpose of inserting C90 implicit

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-11 Thread Momchil Velikov via Phabricator via cfe-commits
chill added inline comments. Comment at: lib/Parse/ParseStmt.cpp:843-845 + return ParseCompoundStatement(isStmtExpr, +Scope::DeclScope | Scope::CompoundStmtScope); } rsmith wrote: > This seems to miss quite a lot of places that

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-09 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/Parse/ParseStmt.cpp:843-845 + return ParseCompoundStatement(isStmtExpr, +Scope::DeclScope | Scope::CompoundStmtScope); } This seems to miss quite a lot of places that introduce

[PATCH] D33676: Place implictly declared functions at block scope

2017-07-07 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Ping. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-23 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. Ping? https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-16 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment. Thanks Momchil, this looks sensible to me. What do you think @aaron.ballman @rsmith ? https://reviews.llvm.org/D33676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-16 Thread Momchil Velikov via Phabricator via cfe-commits
chill added inline comments. Comment at: test/Sema/implicit-decl.c:12 int32_t compCount = 0; - if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} \ - expected-error {{implicit

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-16 Thread Momchil Velikov via Phabricator via cfe-commits
chill updated this revision to Diff 102802. chill added a comment. Update 2: added a testcase involving expression statements https://reviews.llvm.org/D33676 Files: include/clang/Sema/Scope.h lib/Parse/ParseStmt.cpp lib/Sema/SemaDecl.cpp test/Sema/implicit-decl-c90.c

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-08 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment. Given that we are already considering extensions, maybe you want to add a test for compound statements in expressions. void foo(void) { ({ bar(); }); int (*p)() = bar; /* expected-error {{use of undeclared identifier 'bar'}} */ } This already works with

[PATCH] D33676: Place implictly declared functions at block scope

2017-06-06 Thread Momchil Velikov via Phabricator via cfe-commits
chill updated this revision to Diff 101522. chill added a comment. Update 1 notes. The scopes for compound statements are explicitly marked as such, so then `Sema::ImplicitylDefineFunction` can ascend to the nearest enclosing scope. The function scopes (ones with `Scope:FnScope`) do not

[PATCH] D33676: Place implictly declared functions at block scope

2017-05-30 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment. I think what happens is that the implicit declaration is done in the prototype scope which is not visible later. Doing the same as GCC in the handling of this extension is probably the best: note that in C90 a function call should not happen inside an array expression

[PATCH] D33676: Place implictly declared functions at block scope

2017-05-30 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment. In https://reviews.llvm.org/D33676#767746, @rogfer01 wrote: > I understand that the scope `S` in this case is a (function) prototype scope > so it would not be the innermost block scope, would it? That said, GCC does > not accept `p_ok` above so probably this behaviour

[PATCH] D33676: Place implictly declared functions at block scope

2017-05-30 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment. I wonder what should we do in C99 for cases like void foo(void) { { extern void g(int(*a)[call_to_undeclared()]); int (*p_ok)() = call_to_undeclared; } int (*p_err)() = call_to_undeclared; } I understand that the scope `S` in this case

[PATCH] D33676: Place implictly declared functions at block scope

2017-05-30 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a subscriber: cfe-commits. chill added a comment. This issue https://bugs.llvm.org//show_bug.cgi?id=2266 does not appear to trigger anymore, with this patch applied. https://reviews.llvm.org/D33676 ___ cfe-commits mailing list