diff --git a/pyproject.toml b/pyproject.toml index b2d82369..44faff4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,7 @@ requires-python = "==3.14.*" dependencies = [ "arpeggio>=2.0", "pyperclip>=1.8", - "clang==18.1.8", - "libclang==18.1.1", + "libclang-ng==22.1.4.2", "more-itertools>=10.0", "networkx>=3.0", "pyhamcrest>=2.1", diff --git a/src/renaissance/integrations/clang/clang_ast_node.py b/src/renaissance/integrations/clang/clang_ast_node.py index 50b405d8..4eafeb86 100644 --- a/src/renaissance/integrations/clang/clang_ast_node.py +++ b/src/renaissance/integrations/clang/clang_ast_node.py @@ -63,7 +63,7 @@ def _collect_expansions( if child.kind.name == "MACRO_INSTANTIATION": result.add( ( - child.extent.start.file, + child.extent.start.file.name, child.extent.start.offset, child.extent.end.offset, ), @@ -505,6 +505,7 @@ def is_implicit(self): "_WIN64", "_ISO_VOLATILE", "_INTEGRAL_MAX_BITS", + "_CRT_USE_BUILTIN_OFFSETOF", } diff --git a/test/c_cpp/test_c_pattern_factory.py b/test/c_cpp/test_c_pattern_factory.py index 620fe0d2..21af84e5 100644 --- a/test/c_cpp/test_c_pattern_factory.py +++ b/test/c_cpp/test_c_pattern_factory.py @@ -68,7 +68,7 @@ class TestExpression: ( "a == $hallo", ( - "(binary_operation, , test.c[123:134]): |a == $hallo|\n (UNEXPOSED_EXPR, a, test.c[123:124]): |a|\n" + "(binary_operation, ==, test.c[123:134]): |a == $hallo|\n (UNEXPOSED_EXPR, a, test.c[123:124]): |a|\n" " (DECL_REF_EXPR, a, test.c[123:124]): |a|\n (MatchOne, $hallo, test.c[128:134]): |$hallo|\n" " (MatchOne, $hallo, test.c[128:134]): |$hallo|\n" ), @@ -76,14 +76,14 @@ class TestExpression: ( "2 != 3", ( - "(binary_operation, , test.c[105:111]): |2 != 3|\n (literal, , test.c[105:106]): |2|\n" + "(binary_operation, !=, test.c[105:111]): |2 != 3|\n (literal, , test.c[105:106]): |2|\n" " (literal, , test.c[110:111]): |3|\n" ), ), ( "a != b", ( - "(binary_operation, , test.c[118:124]): |a != b|\n (UNEXPOSED_EXPR, a, test.c[118:119]): |a|\n" + "(binary_operation, !=, test.c[118:124]): |a != b|\n (UNEXPOSED_EXPR, a, test.c[118:119]): |a|\n" " (DECL_REF_EXPR, a, test.c[118:119]): |a|\n (UNEXPOSED_EXPR, b, test.c[123:124]): |b|\n" " (DECL_REF_EXPR, b, test.c[123:124]): |b|\n" ), @@ -91,7 +91,7 @@ class TestExpression: ( "b != $world", ( - "(binary_operation, , test.c[123:134]): |b != $world|\n (UNEXPOSED_EXPR, b, test.c[123:124]): |b|\n" + "(binary_operation, !=, test.c[123:134]): |b != $world|\n (UNEXPOSED_EXPR, b, test.c[123:124]): |b|\n" " (DECL_REF_EXPR, b, test.c[123:124]): |b|\n (MatchOne, $world, test.c[128:134]): |$world|\n" " (MatchOne, $world, test.c[128:134]): |$world|\n" ), @@ -99,7 +99,7 @@ class TestExpression: ( "c > $foo", ( - "(binary_operation, , test.c[121:129]): |c > $foo|\n (UNEXPOSED_EXPR, c, test.c[121:122]): |c|\n" + "(binary_operation, >, test.c[121:129]): |c > $foo|\n (UNEXPOSED_EXPR, c, test.c[121:122]): |c|\n" " (DECL_REF_EXPR, c, test.c[121:122]): |c|\n (MatchOne, $foo, test.c[125:129]): |$foo|\n" " (MatchOne, $foo, test.c[125:129]): |$foo|\n" ), @@ -107,7 +107,7 @@ class TestExpression: ( "d < $bar", ( - "(binary_operation, , test.c[121:129]): |d < $bar|\n (UNEXPOSED_EXPR, d, test.c[121:122]): |d|\n" + "(binary_operation, <, test.c[121:129]): |d < $bar|\n (UNEXPOSED_EXPR, d, test.c[121:122]): |d|\n" " (DECL_REF_EXPR, d, test.c[121:122]): |d|\n (MatchOne, $bar, test.c[125:129]): |$bar|\n" " (MatchOne, $bar, test.c[125:129]): |$bar|\n" ), @@ -115,7 +115,7 @@ class TestExpression: ( "e >= $baz", ( - "(binary_operation, , test.c[121:130]): |e >= $baz|\n (UNEXPOSED_EXPR, e, test.c[121:122]): |e|\n" + "(binary_operation, >=, test.c[121:130]): |e >= $baz|\n (UNEXPOSED_EXPR, e, test.c[121:122]): |e|\n" " (DECL_REF_EXPR, e, test.c[121:122]): |e|\n (MatchOne, $baz, test.c[126:130]): |$baz|\n" " (MatchOne, $baz, test.c[126:130]): |$baz|\n" ), @@ -123,7 +123,7 @@ class TestExpression: ( "f <= $qux", ( - "(binary_operation, , test.c[121:130]): |f <= $qux|\n (UNEXPOSED_EXPR, f, test.c[121:122]): |f|\n" + "(binary_operation, <=, test.c[121:130]): |f <= $qux|\n (UNEXPOSED_EXPR, f, test.c[121:122]): |f|\n" " (DECL_REF_EXPR, f, test.c[121:122]): |f|\n (MatchOne, $qux, test.c[126:130]): |$qux|\n" " (MatchOne, $qux, test.c[126:130]): |$qux|\n" ), diff --git a/uv.lock b/uv.lock index 76bae39c..24d972be 100644 --- a/uv.lock +++ b/uv.lock @@ -157,15 +157,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cc/61/d01fc49b8dea277640b55a9e15960dbca9fdc8c9fde18e572d39c59f4019/charset_normalizer-3.5.1-py3-none-any.whl", hash = "sha256:6df0ec430f9a831772c23ca5a224cba36517a58a84bb32c32bb59a9fa67c47f6", size = 68658, upload-time = "2026-08-15T08:20:43.306Z" }, ] -[[package]] -name = "clang" -version = "18.1.8" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/2c/6d/202fe248475f92ab9057a4066d50fe8aaa2def62493894dc9a9814ce8d3b/clang-18.1.8.tar.gz", hash = "sha256:26d11859bab6da8d1fcdb85a244957f6c129a0cd15da2abca3059b054b87635f", size = 3101, upload-time = "2025-02-17T21:49:01.037Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a5/3c/1bebce0b2588b913b48baea6eac5091c023f03cc0c8ab4b015a8315d0d09/clang-18.1.8-py3-none-any.whl", hash = "sha256:2f6a00126743ee23d8fcd2a2338b42ef4d29897f293ee3a1bc4d5925d8ee875c", size = 31627, upload-time = "2025-02-17T21:48:59.215Z" }, -] - [[package]] name = "click" version = "8.3.1" @@ -444,20 +435,16 @@ wheels = [ ] [[package]] -name = "libclang" -version = "18.1.1" +name = "libclang-ng" +version = "22.1.4.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6e/5c/ca35e19a4f142adffa27e3d652196b7362fa612243e2b916845d801454fc/libclang-18.1.1.tar.gz", hash = "sha256:a1214966d08d73d971287fc3ead8dfaf82eb07fb197680d8b3859dbbbbf78250", size = 39612, upload-time = "2024-03-17T16:04:37.434Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/4b/49/f5e3e7e1419872b69f6f5e82ba56e33955a74bd537d8a1f5f1eff2f3668a/libclang-18.1.1-1-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:0b2e143f0fac830156feb56f9231ff8338c20aecfe72b4ffe96f19e5a1dbb69a", size = 25836045, upload-time = "2024-06-30T17:40:31.646Z" }, - { url = "https://files.pythonhosted.org/packages/e2/e5/fc61bbded91a8830ccce94c5294ecd6e88e496cc85f6704bf350c0634b70/libclang-18.1.1-py2.py3-none-macosx_10_9_x86_64.whl", hash = "sha256:6f14c3f194704e5d09769108f03185fce7acaf1d1ae4bbb2f30a72c2400cb7c5", size = 26502641, upload-time = "2024-03-18T15:52:26.722Z" }, - { url = "https://files.pythonhosted.org/packages/db/ed/1df62b44db2583375f6a8a5e2ca5432bbdc3edb477942b9b7c848c720055/libclang-18.1.1-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:83ce5045d101b669ac38e6da8e58765f12da2d3aafb3b9b98d88b286a60964d8", size = 26420207, upload-time = "2024-03-17T15:00:26.63Z" }, - { url = "https://files.pythonhosted.org/packages/1d/fc/716c1e62e512ef1c160e7984a73a5fc7df45166f2ff3f254e71c58076f7c/libclang-18.1.1-py2.py3-none-manylinux2010_x86_64.whl", hash = "sha256:c533091d8a3bbf7460a00cb6c1a71da93bffe148f172c7d03b1c31fbf8aa2a0b", size = 24515943, upload-time = "2024-03-17T16:03:45.942Z" }, - { url = "https://files.pythonhosted.org/packages/3c/3d/f0ac1150280d8d20d059608cf2d5ff61b7c3b7f7bcf9c0f425ab92df769a/libclang-18.1.1-py2.py3-none-manylinux2014_aarch64.whl", hash = "sha256:54dda940a4a0491a9d1532bf071ea3ef26e6dbaf03b5000ed94dd7174e8f9592", size = 23784972, upload-time = "2024-03-17T16:12:47.677Z" }, - { url = "https://files.pythonhosted.org/packages/fe/2f/d920822c2b1ce9326a4c78c0c2b4aa3fde610c7ee9f631b600acb5376c26/libclang-18.1.1-py2.py3-none-manylinux2014_armv7l.whl", hash = "sha256:cf4a99b05376513717ab5d82a0db832c56ccea4fd61a69dbb7bccf2dfb207dbe", size = 20259606, upload-time = "2024-03-17T16:17:42.437Z" }, - { url = "https://files.pythonhosted.org/packages/2d/c2/de1db8c6d413597076a4259cea409b83459b2db997c003578affdd32bf66/libclang-18.1.1-py2.py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:69f8eb8f65c279e765ffd28aaa7e9e364c776c17618af8bff22a8df58677ff4f", size = 24921494, upload-time = "2024-03-17T16:14:20.132Z" }, - { url = "https://files.pythonhosted.org/packages/0b/2d/3f480b1e1d31eb3d6de5e3ef641954e5c67430d5ac93b7fa7e07589576c7/libclang-18.1.1-py2.py3-none-win_amd64.whl", hash = "sha256:4dd2d3b82fab35e2bf9ca717d7b63ac990a3519c7e312f19fa8e86dcc712f7fb", size = 26415083, upload-time = "2024-03-17T16:42:21.703Z" }, - { url = "https://files.pythonhosted.org/packages/71/cf/e01dc4cc79779cd82d77888a88ae2fa424d93b445ad4f6c02bfc18335b70/libclang-18.1.1-py2.py3-none-win_arm64.whl", hash = "sha256:3f0e1f49f04d3cd198985fea0511576b0aee16f9ff0e0f0cad7f9c57ec3c20e8", size = 22361112, upload-time = "2024-03-17T16:42:59.565Z" }, + { url = "https://files.pythonhosted.org/packages/9d/79/93dd7866db6c0b37e1f93abfcc8e87879a46ecd5f52ca46673dd63ff605a/libclang_ng-22.1.4.2-py3-none-macosx_10_9_x86_64.whl", hash = "sha256:25c2a760f92e5a05f70b363e59607a97341a7a778c30b2987cea4bf186c56b57", size = 33911241, upload-time = "2026-04-22T19:13:50.355Z" }, + { url = "https://files.pythonhosted.org/packages/e2/2b/67a2cc4b12c0c7ce1e918e74f0f7fcd40f4509b6a1a1f3b18bd438098b6e/libclang_ng-22.1.4.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:959cb4b15883b19e56704a68eceea015674c0830ecea423aa72e920225cf50ef", size = 33005943, upload-time = "2026-04-22T19:12:22.199Z" }, + { url = "https://files.pythonhosted.org/packages/61/c6/ef0cae4dfb871eaae6811fb7873c64366ca7065ea1a590e858b267a96514/libclang_ng-22.1.4.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:41ee012632993d0ea25c60da539d63ad858bc3261aaa706e5a4286bd2afc8372", size = 29625190, upload-time = "2026-04-22T19:13:35.335Z" }, + { url = "https://files.pythonhosted.org/packages/29/5b/465354e121f7e4ab0023e464d1e5f09165460b0aefbd2fe6250a57620e6d/libclang_ng-22.1.4.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:be0c485e086b1fd66fab5441df8507e863838f5b84f8cd327fe1eda2e93fb07a", size = 30594869, upload-time = "2026-04-22T19:12:25.952Z" }, + { url = "https://files.pythonhosted.org/packages/bb/21/45df66fce5a3d9cf6b42131d1ecc1423bc1f70b8304e27c1ccb3edd40eae/libclang_ng-22.1.4.2-py3-none-win_amd64.whl", hash = "sha256:701b282404800d3fcf6d7d408cfd49ebae3e6a85dfb3f80a920deba67000dfa9", size = 26174249, upload-time = "2026-04-22T19:12:26.286Z" }, + { url = "https://files.pythonhosted.org/packages/b4/05/de1e969a73ac5412b06bb72361c7763767c87be3d7eee12963afa155621f/libclang_ng-22.1.4.2-py3-none-win_arm64.whl", hash = "sha256:a76d7748d13fd47c0a604bfb752c5957171dbd715796daad8cd21b19fe5d8bcf", size = 23510995, upload-time = "2026-04-22T19:12:17.323Z" }, ] [[package]] @@ -1168,10 +1155,9 @@ source = { editable = "." } dependencies = [ { name = "arpeggio" }, { name = "autopep8" }, - { name = "clang" }, { name = "flake8" }, { name = "hypothesmith" }, - { name = "libclang" }, + { name = "libclang-ng" }, { name = "libcst" }, { name = "more-itertools" }, { name = "networkx" }, @@ -1234,10 +1220,9 @@ test = [ requires-dist = [ { name = "arpeggio", specifier = ">=2.0" }, { name = "autopep8", specifier = ">=2.0" }, - { name = "clang", specifier = "==18.1.8" }, { name = "flake8", specifier = ">=7.0" }, { name = "hypothesmith", specifier = ">=0.3.3" }, - { name = "libclang", specifier = "==18.1.1" }, + { name = "libclang-ng", specifier = "==22.1.4.2" }, { name = "libcst", specifier = ">=1.8.6" }, { name = "more-itertools", specifier = ">=10.0" }, { name = "networkx", specifier = ">=3.0" },