[clang] [Clang][Sema] Reject invalid member using-declaration whose nested-name-specifier doesn't refer to a base class of the current class in C++98 mode (PR #143492)

2025-06-25 Thread Vlad Serebrennikov via cfe-commits
@@ -36,6 +36,13 @@ namespace cwg400 { // cwg400: 2.7 // expected-error@-1 {{member 'a' found in multiple base classes of different types}} // expected-note@#cwg400-A {{member type 'cwg400::A::a' found by ambiguous name lookup}} // expected-note@#cwg400-B {{member ty

[clang] [Clang][Sema] Reject invalid member using-declaration whose nested-name-specifier doesn't refer to a base class of the current class in C++98 mode (PR #143492)

2025-06-25 Thread Vlad Serebrennikov via cfe-commits
@@ -159,6 +159,11 @@ Resolutions to C++ Defect Reports - Implemented `CWG2496 ref-qualifiers and virtual overriding `_. +- Fully implemented `CWG400 Using-declarations and the "struct hack" ` + ``_. Correctly rejected inv

[clang] [Clang][Sema] Reject invalid member using-declaration whose nested-name-specifier doesn't refer to a base class of the current class in C++98 mode (PR #143492)

2025-06-25 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: I think we need an entry in "Potentially breaking changes" section. Also, you should shorten the title of the PR, so that commit message is not overly long. Maybe something along the lines of `[clang] Require member using-declarations to name a base class`.

[clang] [Clang][Sema] Reject invalid member using-declaration whose nested-name-specifier doesn't refer to a base class of the current class in C++98 mode (PR #143492)

2025-06-25 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/143492 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-14 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: It appears that CWG400 has two parts to it: 1. An arguably primary part of the issue is concerned with how many declarations using-declaration can name (one vs many). This is what the recorded discussion is about, and what Richard wrote tests for back in 20

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Vlad Serebrennikov via cfe-commits
@@ -1429,7 +1429,7 @@ namespace cwg299 { // cwg299: 2.8 c++11 // cxx98-11-error@#cwg299-q {{ambiguous conversion of array size expression of type 'T' to an integral or enumeration type}} // cxx98-11-note@#cwg299-int {{conversion to integral type 'int' declared here}} /

[clang] [Clang][Sema] Apply CWG400 'Using-declarations and the "struct hack"' to C++98 mode (PR #143492)

2025-06-12 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: Tests in this PR needs to be evaluated against the existing wording, and not just against 20-years-old wording. I'm still not finished with that. https://github.com/llvm/llvm-project/pull/143492 ___ cfe-commits mailing list cfe-commits@

[clang] [Clang] Added explanation why a is constructible evaluated to false. (PR #143309)

2025-06-12 Thread Vlad Serebrennikov via cfe-commits
@@ -564,11 +564,12 @@ struct A { namespace ex2 { #if __cplusplus >= 201103L struct Bar { - struct Baz { + struct Baz { // #Baz Endilll wrote: ```suggestion struct Baz { // #cwg1890-Baz ``` https://github.com/llvm/llvm-project/pull/143309 _

[clang] Remove delayed typo expressions (PR #143423)

2025-06-10 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Changes to DR tests LGTM https://github.com/llvm/llvm-project/pull/143423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2496 (PR #142975)

2025-06-09 Thread Vlad Serebrennikov via cfe-commits
@@ -215,3 +215,32 @@ void (*q)() throw() = S(); // since-cxx17-error@-1 {{no viable conversion from 'S' to 'void (*)() throw()'}} // since-cxx17-note@#cwg2486-conv {{candidate function}} } // namespace cwg2486 + + +namespace cwg2496 { // cwg2496: 21 +#if __cplusplus >= 20110

[clang] [Clang] Implement CWG2496 (PR #142975)

2025-06-09 Thread Vlad Serebrennikov via cfe-commits
@@ -215,3 +215,32 @@ void (*q)() throw() = S(); // since-cxx17-error@-1 {{no viable conversion from 'S' to 'void (*)() throw()'}} // since-cxx17-note@#cwg2486-conv {{candidate function}} } // namespace cwg2486 + + +namespace cwg2496 { // cwg2496: 21 +#if __cplusplus >= 20110

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-07 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > e.g. Python int maps to both c_int and c_uint Good example, thank you. So the crux of the issue is that we need to reconstruct one kind of function prototype from another. On the one hand, type annotations are consumed (mostly) statically, while ctypes prototype is consumed d

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: There are useful suggestions in the comments of https://github.com/python/mypy/issues/7540, but it's sad that we need to resort to something like this 10 years after type annotations became a thing. https://github.com/llvm/llvm-project/pull/142120 ___

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: Good news: typeshed has annotations for ctypes, and they have annotations for `_CPointer` that might come helpful for us: https://github.com/python/typeshed/blob/b25a5b6aef4b18226a9fd367421ed8ebaaed9528/stdlib/_ctypes.pyi#L76-L87 Bad news: they admit that they can't model implici

[clang] [Clang] Implement CWG2496 (PR #142975)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
@@ -215,3 +215,23 @@ void (*q)() throw() = S(); // since-cxx17-error@-1 {{no viable conversion from 'S' to 'void (*)() throw()'}} // since-cxx17-note@#cwg2486-conv {{candidate function}} } // namespace cwg2486 + + +namespace cwg2496 { // cwg2496: 21 +#if __cplusplus >= 20110

[clang] [Clang] Implement CWG2496 (PR #142975)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/142975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement CWG2496 (PR #142975)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Can you test full 3x3 matrix of combinations of ref-qualifiers between overriding and overridden functions? https://github.com/llvm/llvm-project/pull/142975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Docs] Explicitly document libclang ABI and API stability (PR #141657)

2025-06-05 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/141657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Added TypeKind.FLOAT16 for 32 in cindex.py (PR #142634)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > ⚠️ We detected that you are using a GitHub private e-mail address to > contribute to the repo. Please turn off [Keep my email addresses > private](https://github.com/settings/emails) setting in your account. See > [LLVM > Discourse](https://discourse.llvm.org/t/hidden-emails-

[clang] Added TypeKind.FLOAT16 for 32 in cindex.py (PR #142634)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll approved this pull request. I never meant to block this PR on the presence of an additional test infrastructure. https://github.com/llvm/llvm-project/pull/142634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang][python][test] Check if libclang.so is loadable (PR #142353)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: We generally avoid XFAIL tests, instead we do normal tests where we expect the wrong behavior and leave a TODO. In this case UNSUPPORTED makes more sense. https://github.com/llvm/llvm-project/pull/142353 ___ cfe-commits mailing list cfe

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Thank you for exploring this. I think there is a way forward. https://github.com/llvm/llvm-project/pull/142120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
@@ -3986,256 +3987,588 @@ def set_property(self, property, value): # Now comes the plumbing to hook up the C library. # Register callback types -translation_unit_includes_callback = CFUNCTYPE( +translation_unit_includes_callback: TypeAlias = CFUNCTYPE( # type: ignore [valid-

[clang] [libclang/python] Derive library function types from annotations (PR #142120)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/142120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Added TypeKind.FLOAT16 for 32 in cindex.py (PR #142634)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > > Time to put libclang to use, and parse cindex.h? > > Probably, though I'll check if there are any more direct options first. I > don't quite like the idea of hardcoding source file paths in bindings tests. If that helps, it should be available using a relatively stable path,

[clang] Added TypeKind.FLOAT16 for 32 in cindex.py (PR #142634)

2025-06-04 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > Seems like we're missing a bunch of `TypeKind`s, currently missing 33 - 39 > and 179 - 181 enum variants. 180 and 181 were only added the other day, we > might want to look into some way to test these automatically to ensure that > any additions are also added on Python side i

[clang] [clang][python][test] Check if libclang.so is loadable (PR #142353)

2025-06-02 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: @rorth Now that https://github.com/llvm/llvm-project/pull/142371 is merged, can you re-evaluate this PR and update the description? https://github.com/llvm/llvm-project/pull/142353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [libclang/python] Properly report errors when test fails (PR #142371)

2025-06-02 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/142371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Properly report errors when test fails (PR #142371)

2025-06-02 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Have you reproduced the issue and checked that this fix does what's it supposed to do? https://github.com/llvm/llvm-project/pull/142371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [clang][python][test] Check if libclang.so is loadable (PR #142353)

2025-06-02 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/142353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][python][test] Check if libclang.so is loadable (PR #142353)

2025-06-02 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Thank you for the PR. Several points: 1) What happens on Windows? 2) `check-clang-python` is just one of the ways to run into this. `cindex.py` is a user-facing interface, so we shouldn't emit messages that make sense only during development. 3) The fact th

[clang] [Docs] Explicitly document libclang ABI and API stability (PR #141657)

2025-05-28 Thread Vlad Serebrennikov via cfe-commits
@@ -373,19 +373,21 @@ implementation of the facilities by Clang may change behavior as bugs are fixed, features get implemented, etc. The library should be ABI and API stable over time, but ABI- and API-breaking -changes can happen in the following situations: +changes can ha

[clang] [Docs] Explicitly document libclang ABI and API stability (PR #141657)

2025-05-28 Thread Vlad Serebrennikov via cfe-commits
@@ -373,19 +373,21 @@ implementation of the facilities by Clang may change behavior as bugs are fixed, features get implemented, etc. The library should be ABI and API stable over time, but ABI- and API-breaking -changes can happen in the following situations: +changes can ha

[clang] [Docs] Explicitly document libclang ABI and API stability (PR #141657)

2025-05-27 Thread Vlad Serebrennikov via cfe-commits
@@ -358,3 +358,46 @@ Complete example code .. _Index.h: https://github.com/llvm/llvm-project/blob/main/clang/include/clang-c/Index.h + +.. _Stability: + +ABI and API Stability +- + +The C interfaces in libclang are intended to be relatively stable. This a

[clang] [libclang/python][NFC] Explain how null cursors are handled in docstring (PR #140499)

2025-05-19 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/140499 >From 445eacab8a326d3abcca95a31f07c272d0d155e7 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Mon, 19 May 2025 09:24:36 +0300 Subject: [PATCH 1/2] [libclang/python][NFC] Explain how null cursors are ha

[clang] [libclang/python] Simplify __eq__ operators (PR #140540)

2025-05-19 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Why does the diff show that you add `__ne__` operator, even though it's already present? What am I missing? https://github.com/llvm/llvm-project/blob/f3d36b15f6dde7ca2d080279274d5d0f4bfc8c30/clang/bindings/python/clang/cindex.py#L397-L403 https://github.com

[clang] [libclang/python][NFC] Document how null cursors are handled (PR #140499)

2025-05-19 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/140499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python][NFC] Document how null cursors are handled (PR #140499)

2025-05-19 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/140499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python][NFC] Explain how null cursors are handled in docstring (PR #140499)

2025-05-19 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/140499 Now that we looked at this aspect closely and fixed things, I think we can document this. >From 445eacab8a326d3abcca95a31f07c272d0d155e7 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Mon, 19 May 2025

[clang] [libclang/python] Add `Cursor.from_translation_unit` (PR #140496)

2025-05-18 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/140496 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add `Cursor.from_translation_unit` (PR #140496)

2025-05-18 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: Hmm, so the reason we have `Cursor.from_source_location` is that SourceLocation doesn't hold a reference to TU. Yeah, I guess we don't need this. https://github.com/llvm/llvm-project/pull/140496 ___ cfe-commits mailing list cfe-commits@

[clang] [libclang/python] Add `Cursor.from_translation_unit` (PR #140496)

2025-05-18 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/140496 This should complete the list of things `Cursor` can be made from. >From 2fa8240df89d195c25da9d0ee52101830ae41677 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Mon, 19 May 2025 09:20:55 +0300 Subject:

[clang] [libclang/python] Add typing annotations for the Type class (PR #140378)

2025-05-18 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > LLVM Buildbot has detected a new failure on builder `clang-s390x-linux-lnt` > running on `systemz-1` while building `clang` at step 13 "setup lit". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/136/builds/3945 > Here is the relevant piece of the

[clang] [libclang/python] Add typing annotations for the Type class (PR #140378)

2025-05-18 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > LLVM Buildbot has detected a new failure on builder `clang-s390x-linux-lnt` > running on `systemz-1` while building `clang` at step 13 "setup lit". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/136/builds/3945 > Here is the relevant piece of the

[clang] [libclang/python] Add typing annotations for the Type class (PR #140378)

2025-05-17 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/140378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Type class (PR #140378)

2025-05-17 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/140378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Type class (PR #140378)

2025-05-17 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Our error-handling story is bad and inconsistent, but that's out of scope of this PR https://github.com/llvm/llvm-project/pull/140378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: You should put "Fixes #120388" in the description, and remove the issue number from the title, because it will be confusing after merging, when number of this PR will be added to the title. https://github.com/llvm/llvm-project/pull/140247 ___

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f(void) { + int_val2 = 0; // expected-error{{use of undeclared identifier}} + sin(0); // expected-error{{use of undeclared identifier 'sin'}} \ + // expected-note{{perhaps `#include ` is needed?}} + +

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
@@ -1474,6 +1474,7 @@ namespace cwg387 { // cwg387: 2.8 a = gcd(a, b); b = gcd(3, 4); // expected-error@-1 {{use of undeclared identifier 'gcd'}} + // expected-note@-2 {{perhaps `#include ` is needed?}} Endilll wrote: ```suggestion

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
@@ -26,14 +26,18 @@ void no_get_1() { auto [a0, a1] = A(); // expected-error {{decomposes into 3 elements}} auto [b0, b1] = B(); // expected-error {{decomposes into 3 elements}} } - auto [a0, a1, a2] = A(); // expected-error {{undeclared identifier 'get'}} expected-

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
@@ -1489,6 +1490,7 @@ namespace cwg387 { // cwg387: 2.8 a = gcd(a, b); b = gcd(3, 4); // expected-error@-1 {{use of undeclared identifier 'gcd'}} + // expected-note@-2 {{perhaps `#include ` is needed?}} Endilll wrote: ```suggestion

[clang] [Clang] suggest headers on undeclared errors (#120388) (PR #140247)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f(void) { + int_val2 = 0; // expected-error{{use of undeclared identifier}} + sin(0); // expected-error{{use of undeclared identifier 'sin'}} \ + // expected-note{{perhaps `#include ` is needed?}} + +

[clang] [llvm] Revert "[clang] Add scoped enum support to `StreamingDiagnostic`" (PR #138139)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/138139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python][NFC] Refactor wildcard import of `ctypes` (PR #140191)

2025-05-16 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/140191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/138103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -77,6 +77,8 @@ Clang Frontend Potentially Breaking Changes Clang Python Bindings Potentially Breaking Changes -- +- Calling methods on null-cursors now leads to an exception. Endilll wrote: ```suggestion - Al

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Can you swap release notes entries? They will make more sense this way when my suggestions are applied https://github.com/llvm/llvm-project/pull/138103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -77,6 +77,8 @@ Clang Frontend Potentially Breaking Changes Clang Python Bindings Potentially Breaking Changes -- +- Calling methods on null-cursors now leads to an exception. +- ``Cursor.from_location`` now returns ``None`` in

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/138103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1545,6 +1545,16 @@ class ExceptionSpecificationKind(BaseEnumeration): ### Cursors ### +# This guard is used to ensure that no operations are possible on null cursors Endilll wrote: Yes, I think documentation on hover is helpful, which doesn't work withou

[clang] [libclang/python] Ensure all used library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Ensure all used library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,30 @@ +import os + +import clang.cindex + +if "CLANG_LIBRARY_PATH" in os.environ: +clang.cindex.Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest +import ast + + +class TestLib(unittest.TestCase): +def test_functions_registered(self):

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1763,19 +1799,22 @@ def get_usr(self): another translation unit.""" return _CXString.from_result(conf.lib.clang_getCursorUSR(self)) -def get_included_file(self): +@cursor_null_guard +def get_included_file(self) -> File: """Returns the F

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: PR title should mention somewhere that only used functions are registered. https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [libclang/python][NFC] Refactor wildcard import of `ctypes` (PR #140191)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/140191 The list is not that long. >From 10ebe5e6ba45e747b3bee2fe686810abf91ded18 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 16 May 2025 08:12:49 +0300 Subject: [PATCH] [libclang/python][NFC] Refactor

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Can you also add a release note? https://github.com/llvm/llvm-project/pull/138103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1552,68 +1553,85 @@ class Cursor(Structure): _fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)] +_tu: TranslationUnit + +# This ensures that no operations are possible on null cursors +# by guarding all method calls with a not-null

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1552,68 +1563,83 @@ class Cursor(Structure): _fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)] +_tu: TranslationUnit + @staticmethod -def from_location(tu, location): +def from_location(tu: TranslationUnit, location: SourceLoc

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1763,19 +1799,22 @@ def get_usr(self): another translation unit.""" return _CXString.from_result(conf.lib.clang_getCursorUSR(self)) -def get_included_file(self): +@cursor_null_guard +def get_included_file(self) -> File: """Returns the F

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1821,45 +1824,45 @@ def mangled_name(self): return self._mangled_name @property -def location(self): +def location(self) -> SourceLocation: """ Return the source location (the starting character) of the entity pointed at by th

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -1545,6 +1545,16 @@ class ExceptionSpecificationKind(BaseEnumeration): ### Cursors ### +# This guard is used to ensure that no operations are possible on null cursors Endilll wrote: I think this comment should also go into high-level matters (that null cu

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: I https://github.com/llvm/llvm-project/pull/140015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Ensure all library functions are registered (PR #140015)

2025-05-15 Thread Vlad Serebrennikov via cfe-commits
@@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: +Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): +def test_functions_register

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-14 Thread Vlad Serebrennikov via cfe-commits
@@ -1552,68 +1553,85 @@ class Cursor(Structure): _fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)] +_tu: TranslationUnit + +# This ensures that no operations are possible on null cursors +# by guarding all method calls with a not-null

[clang] d441d28 - [clang][NFC] Fix indentation in a comment

2025-05-14 Thread Vlad Serebrennikov via cfe-commits
Author: Vlad Serebrennikov Date: 2025-05-14T11:43:21+03:00 New Revision: d441d28083e2f9de5170f5a96a8e44a38d306c62 URL: https://github.com/llvm/llvm-project/commit/d441d28083e2f9de5170f5a96a8e44a38d306c62 DIFF: https://github.com/llvm/llvm-project/commit/d441d28083e2f9de5170f5a96a8e44a38d306c62.

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-13 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/138511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-13 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: Numbers for clang-format uncleanliness of `Parser.h` with changes from this PR: `92 insertions(+), 87 deletions(-)` (all in grammar productions). https://github.com/llvm/llvm-project/pull/138511 ___ cfe-commits mailing list cfe-commits@

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-12 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/138103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-12 Thread Vlad Serebrennikov via cfe-commits
@@ -1821,45 +1824,45 @@ def mangled_name(self): return self._mangled_name @property -def location(self): +def location(self) -> SourceLocation: """ Return the source location (the starting character) of the entity pointed at by th

[clang] [Clang][RFC] Do not eat SFINAE diagnostics for explicit template arguments (PR #139066)

2025-05-08 Thread Vlad Serebrennikov via cfe-commits
@@ -985,7 +985,9 @@ namespace cwg354 { // cwg354: 3.1 c++11 int b1 = both<(int*)0>(); // cxx98-error@-1 {{no matching function for call to 'both'}} // cxx98-note@#cwg354-both-int-ptr {{candidate template ignored: invalid explicitly-specified argument for 1st template p

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-07 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > > > > 3. File has been formatted with clang-format, except for the grammar, > > > > because clang-format butchers it. > > > > > > > > > Yeah, this problem comes up rather frequently, I wonder if clang-format > > > can get some additional smarts to make that less of a challeng

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-07 Thread Vlad Serebrennikov via cfe-commits
@@ -59,8 +59,8 @@ Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies) PreferredType(&actions.getASTContext(), pp.isCodeCompletionEnabled()), Actions(actions), Diags(PP.getDiagnostics()), StackHandler(Diags), GreaterThanIsOperator(true), C

[clang] [Clang] Fix the warning group of several compatibilty diagnostics (PR #138872)

2025-05-07 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: Changes to DR tests look good https://github.com/llvm/llvm-project/pull/138872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-07 Thread Vlad Serebrennikov via cfe-commits
@@ -1821,45 +1824,45 @@ def mangled_name(self): return self._mangled_name @property -def location(self): +def location(self) -> SourceLocation: """ Return the source location (the starting character) of the entity pointed at by th

[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

2025-05-07 Thread Vlad Serebrennikov via cfe-commits
@@ -1913,7 +1916,7 @@ def type(self): return self._type @property -def canonical(self): +def canonical(self) -> Cursor | None: """Return the canonical Cursor corresponding to this Cursor. Endilll wrote: > That said, the input to i

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-05 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > I think downstreams need some kind of notification that this large of a > change is coming; can you post something to Discourse to alert them and > encourage them to mention any major hardships on this PR? https://discourse.llvm.org/t/parser-h-reorganization-pr/86178 https://

[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

2025-05-05 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > > 3. File has been formatted with clang-format, except for the grammar, > > because clang-format butchers it. > > Yeah, this problem comes up rather frequently, I wonder if clang-format can > get some additional smarts to make that less of a challenge? CC > @mydeveloperday @o

[clang] Remove duplicate API (PR #132776)

2025-05-05 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: I've seen this failure before, I don't think it's related to this PR. https://github.com/llvm/llvm-project/pull/132776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cf2f13a - [clang][NFC] Convert `Sema::CCEKind` to scoped enum

2025-05-02 Thread Vlad Serebrennikov via cfe-commits
Author: Vlad Serebrennikov Date: 2025-05-02T14:01:40+03:00 New Revision: cf2f13a867fb86b5c7ce33df8a569477dce71f4f URL: https://github.com/llvm/llvm-project/commit/cf2f13a867fb86b5c7ce33df8a569477dce71f4f DIFF: https://github.com/llvm/llvm-project/commit/cf2f13a867fb86b5c7ce33df8a569477dce71f4f.

[clang] 6e63b68 - [clang][NFC] Convert `Sema::OverloadKind` to scoped enum

2025-05-02 Thread Vlad Serebrennikov via cfe-commits
Author: Vlad Serebrennikov Date: 2025-05-02T13:44:32+03:00 New Revision: 6e63b68389983194b5007d8d489e74d1ffcea500 URL: https://github.com/llvm/llvm-project/commit/6e63b68389983194b5007d8d489e74d1ffcea500 DIFF: https://github.com/llvm/llvm-project/commit/6e63b68389983194b5007d8d489e74d1ffcea500.

[clang] 4ba2778 - [clang][NFC] Convert `Sema::CorrectTypoKind` to scoped enum

2025-05-02 Thread Vlad Serebrennikov via cfe-commits
Author: Vlad Serebrennikov Date: 2025-05-02T13:20:41+03:00 New Revision: 4ba27780d34916d4a856e6593035b15a5cace56e URL: https://github.com/llvm/llvm-project/commit/4ba27780d34916d4a856e6593035b15a5cace56e DIFF: https://github.com/llvm/llvm-project/commit/4ba27780d34916d4a856e6593035b15a5cace56e.

  1   2   3   4   5   6   7   8   9   10   >