Skip to content

Commit 6b1e24a

Browse files
committed
merge main into amd-staging
Change-Id: I411f1f329cb0cce38a8cd71225a55e7b43f7c5c8
2 parents 525938b + 6ff8091 commit 6b1e24a

File tree

1,488 files changed

+71300
-18811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,488 files changed

+71300
-18811
lines changed

clang/Maintainers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Sema
7272
Experimental new constant interpreter
7373
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7474
| Timm Bäder
75-
| tbaeder\@redhat.com (em), tbaeder (Phabricator), tbaederr (GitHub), tbaeder (Discourse), tbaeder (Discord)
75+
| tbaeder\@redhat.com (email), tbaeder (Phabricator), tbaederr (GitHub), tbaeder (Discourse), tbaeder (Discord)
7676
7777

7878
Modules & serialization

clang/bindings/python/tests/cindex/test_access_specifiers.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import AccessSpecifier, Config
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import AccessSpecifier
8-
from clang.cindex import Cursor
9-
from clang.cindex import TranslationUnit
10-
11-
from .util import get_cursor
12-
from .util import get_tu
13-
148
import unittest
159

10+
from .util import get_cursor, get_tu
11+
1612

1713
class TestAccessSpecifiers(unittest.TestCase):
1814
def test_access_specifiers(self):

clang/bindings/python/tests/cindex/test_cdb.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import CompilationDatabase, CompilationDatabaseError, Config
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import CompilationDatabase
8-
from clang.cindex import CompilationDatabaseError
9-
from clang.cindex import CompileCommands
10-
from clang.cindex import CompileCommand
11-
import os
128
import gc
139
import unittest
1410
import sys
15-
from .util import skip_if_no_fspath
16-
from .util import str_to_path
17-
11+
from pathlib import Path
1812

1913
kInputsDir = os.path.join(os.path.dirname(__file__), "INPUTS")
2014

@@ -31,7 +25,7 @@ def test_create_fail(self):
3125
with open(os.devnull, "wb") as null:
3226
os.dup2(null.fileno(), 2)
3327
with self.assertRaises(CompilationDatabaseError) as cm:
34-
cdb = CompilationDatabase.fromDirectory(path)
28+
CompilationDatabase.fromDirectory(path)
3529
os.dup2(stderr, 2)
3630
os.close(stderr)
3731

@@ -40,21 +34,18 @@ def test_create_fail(self):
4034

4135
def test_create(self):
4236
"""Check we can load a compilation database"""
43-
cdb = CompilationDatabase.fromDirectory(kInputsDir)
37+
CompilationDatabase.fromDirectory(kInputsDir)
4438

4539
def test_lookup_succeed(self):
4640
"""Check we get some results if the file exists in the db"""
4741
cdb = CompilationDatabase.fromDirectory(kInputsDir)
4842
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
4943
self.assertNotEqual(len(cmds), 0)
5044

51-
@skip_if_no_fspath
5245
def test_lookup_succeed_pathlike(self):
5346
"""Same as test_lookup_succeed, but with PathLikes"""
54-
cdb = CompilationDatabase.fromDirectory(str_to_path(kInputsDir))
55-
cmds = cdb.getCompileCommands(
56-
str_to_path("/home/john.doe/MyProject/project.cpp")
57-
)
47+
cdb = CompilationDatabase.fromDirectory(Path(kInputsDir))
48+
cmds = cdb.getCompileCommands(Path("/home/john.doe/MyProject/project.cpp"))
5849
self.assertNotEqual(len(cmds), 0)
5950

6051
def test_all_compilecommand(self):
@@ -175,7 +166,7 @@ def test_compilationDB_references(self):
175166
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
176167
del cdb
177168
gc.collect()
178-
workingdir = cmds[0].directory
169+
cmds[0].directory
179170

180171
def test_compilationCommands_references(self):
181172
"""Ensure CompilationsCommand keeps a reference to CompilationCommands"""
@@ -185,4 +176,4 @@ def test_compilationCommands_references(self):
185176
cmd0 = cmds[0]
186177
del cmds
187178
gc.collect()
188-
workingdir = cmd0.directory
179+
cmd0.directory

clang/bindings/python/tests/cindex/test_code_completion.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import Config, TranslationUnit
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import TranslationUnit
8-
98
import unittest
10-
from .util import skip_if_no_fspath
11-
from .util import str_to_path
9+
from pathlib import Path
1210

1311

1412
class TestCodeCompletion(unittest.TestCase):
@@ -57,11 +55,10 @@ def test_code_complete(self):
5755
]
5856
self.check_completion_results(cr, expected)
5957

60-
@skip_if_no_fspath
6158
def test_code_complete_pathlike(self):
6259
files = [
6360
(
64-
str_to_path("fake.c"),
61+
Path("fake.c"),
6562
"""
6663
/// Aaa.
6764
int test1;
@@ -77,14 +74,14 @@ def test_code_complete_pathlike(self):
7774
]
7875

7976
tu = TranslationUnit.from_source(
80-
str_to_path("fake.c"),
77+
Path("fake.c"),
8178
["-std=c99"],
8279
unsaved_files=files,
8380
options=TranslationUnit.PARSE_INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION,
8481
)
8582

8683
cr = tu.codeComplete(
87-
str_to_path("fake.c"),
84+
Path("fake.c"),
8885
9,
8986
1,
9087
unsaved_files=files,

clang/bindings/python/tests/cindex/test_comment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import Config, TranslationUnit
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import TranslationUnit
8-
from tests.cindex.util import get_cursor
9-
108
import unittest
119

10+
from .util import get_cursor
11+
1212

1313
class TestComment(unittest.TestCase):
1414
def test_comment(self):

clang/bindings/python/tests/cindex/test_cursor.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import (
4+
AvailabilityKind,
5+
BinaryOperator,
6+
Config,
7+
CursorKind,
8+
StorageClass,
9+
TemplateArgumentKind,
10+
TranslationUnit,
11+
TypeKind,
12+
)
313

414
if "CLANG_LIBRARY_PATH" in os.environ:
515
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
616

7-
import ctypes
817
import gc
918
import unittest
1019

11-
from clang.cindex import AvailabilityKind
12-
from clang.cindex import CursorKind
13-
from clang.cindex import TemplateArgumentKind
14-
from clang.cindex import TranslationUnit
15-
from clang.cindex import TypeKind
16-
from clang.cindex import BinaryOperator
17-
from clang.cindex import StorageClass
18-
from .util import get_cursor
19-
from .util import get_cursors
20-
from .util import get_tu
21-
20+
from .util import get_cursor, get_cursors, get_tu
2221

2322
kInput = """\
2423
struct s0 {
@@ -170,7 +169,7 @@ def test_references(self):
170169
self.assertIsInstance(cursor.translation_unit, TranslationUnit)
171170

172171
# If the TU was destroyed, this should cause a segfault.
173-
parent = cursor.semantic_parent
172+
cursor.semantic_parent
174173

175174
def test_canonical(self):
176175
source = "struct X; struct X; struct X { int member; };"
@@ -344,7 +343,7 @@ class Bar {
344343
)
345344

346345
self.assertEqual(len(copy_assignment_operators_cursors), 10)
347-
self.assertTrue(len(non_copy_assignment_operators_cursors), 9)
346+
self.assertEqual(len(non_copy_assignment_operators_cursors), 7)
348347

349348
self.assertTrue(
350349
all(

clang/bindings/python/tests/cindex/test_cursor_kind.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import Config, CursorKind
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import CursorKind
8-
98
import unittest
109

1110

clang/bindings/python/tests/cindex/test_diagnostics.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import Config, Diagnostic
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
from clang.cindex import *
8-
from .util import get_tu
9-
108
import unittest
119

10+
from .util import get_tu
1211

1312
# FIXME: We need support for invalid translation units to test better.
1413

clang/bindings/python/tests/cindex/test_enums.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import unittest
22

33
from clang.cindex import (
4-
TokenKind,
4+
AccessSpecifier,
5+
AvailabilityKind,
6+
BinaryOperator,
57
CursorKind,
6-
TemplateArgumentKind,
78
ExceptionSpecificationKind,
8-
AvailabilityKind,
9-
AccessSpecifier,
10-
TypeKind,
11-
RefQualifierKind,
129
LinkageKind,
13-
TLSKind,
10+
RefQualifierKind,
1411
StorageClass,
15-
BinaryOperator,
12+
TemplateArgumentKind,
13+
TLSKind,
14+
TokenKind,
15+
TypeKind,
1616
)
1717

1818

clang/bindings/python/tests/cindex/test_exception_specification_kind.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import os
2-
from clang.cindex import Config
2+
3+
from clang.cindex import Config, CursorKind, ExceptionSpecificationKind
34

45
if "CLANG_LIBRARY_PATH" in os.environ:
56
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
67

7-
import clang.cindex
8-
from clang.cindex import ExceptionSpecificationKind
9-
from .util import get_tu
10-
118
import unittest
129

10+
from .util import get_tu
11+
1312

1413
def find_function_declarations(node, declarations=[]):
15-
if node.kind == clang.cindex.CursorKind.FUNCTION_DECL:
14+
if node.kind == CursorKind.FUNCTION_DECL:
1615
declarations.append(node)
1716
for child in node.get_children():
1817
declarations = find_function_declarations(child, declarations)

0 commit comments

Comments
 (0)