Skip to content

Commit eaf5c51

Browse files
Merge branch 'main' into P2278R4_cbegin
2 parents 8b50c88 + 23e2a04 commit eaf5c51

File tree

638 files changed

+48040
-10843
lines changed

Some content is hidden

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

638 files changed

+48040
-10843
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
path: |
8080
**/test-results.xml
8181
**/*.abilist
82+
**/CMakeConfigureLog.yaml
8283
**/CMakeError.log
8384
**/CMakeOutput.log
8485
**/crash_diagnostics/*
@@ -123,6 +124,7 @@ jobs:
123124
path: |
124125
**/test-results.xml
125126
**/*.abilist
127+
**/CMakeConfigureLog.yaml
126128
**/CMakeError.log
127129
**/CMakeOutput.log
128130
**/crash_diagnostics/*
@@ -188,6 +190,7 @@ jobs:
188190
path: |
189191
**/test-results.xml
190192
**/*.abilist
193+
**/CMakeConfigureLog.yaml
191194
**/CMakeError.log
192195
**/CMakeOutput.log
193196
**/crash_diagnostics/*
@@ -230,6 +233,7 @@ jobs:
230233
path: |
231234
**/test-results.xml
232235
**/*.abilist
236+
**/CMakeConfigureLog.yaml
233237
**/CMakeError.log
234238
**/CMakeOutput.log
235239
**/crash_diagnostics/*

clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct CognitiveComplexity final {
126126
// Limit of 25 is the "upstream"'s default.
127127
static constexpr unsigned DefaultLimit = 25U;
128128

129-
// Based on the publicly-avaliable numbers for some big open-source projects
129+
// Based on the publicly-available numbers for some big open-source projects
130130
// https://sonarcloud.io/projects?languages=c%2Ccpp&size=5 we can estimate:
131131
// value ~20 would result in no allocs for 98% of functions, ~12 for 96%, ~10
132132
// for 91%, ~8 for 88%, ~6 for 84%, ~4 for 77%, ~2 for 64%, and ~1 for 37%.

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,10 @@ class SymbolCollector::HeaderFileURICache {
335335
}
336336

337337
struct FrameworkHeaderPath {
338-
// Path to the framework directory containing the Headers/PrivateHeaders
339-
// directories e.g. /Frameworks/Foundation.framework/
340-
llvm::StringRef HeadersParentDir;
338+
// Path to the frameworks directory containing the .framework directory.
339+
llvm::StringRef FrameworkParentDir;
340+
// Name of the framework.
341+
llvm::StringRef FrameworkName;
341342
// Subpath relative to the Headers or PrivateHeaders dir, e.g. NSObject.h
342343
// Note: This is NOT relative to the `HeadersParentDir`.
343344
llvm::StringRef HeaderSubpath;
@@ -351,19 +352,17 @@ class SymbolCollector::HeaderFileURICache {
351352
path::reverse_iterator I = path::rbegin(Path);
352353
path::reverse_iterator Prev = I;
353354
path::reverse_iterator E = path::rend(Path);
355+
FrameworkHeaderPath HeaderPath;
354356
while (I != E) {
355-
if (*I == "Headers") {
356-
FrameworkHeaderPath HeaderPath;
357-
HeaderPath.HeadersParentDir = Path.substr(0, I - E);
357+
if (*I == "Headers" || *I == "PrivateHeaders") {
358358
HeaderPath.HeaderSubpath = Path.substr(Prev - E);
359-
HeaderPath.IsPrivateHeader = false;
360-
return HeaderPath;
361-
}
362-
if (*I == "PrivateHeaders") {
363-
FrameworkHeaderPath HeaderPath;
364-
HeaderPath.HeadersParentDir = Path.substr(0, I - E);
365-
HeaderPath.HeaderSubpath = Path.substr(Prev - E);
366-
HeaderPath.IsPrivateHeader = true;
359+
HeaderPath.IsPrivateHeader = *I == "PrivateHeaders";
360+
if (++I == E)
361+
break;
362+
HeaderPath.FrameworkName = *I;
363+
if (!HeaderPath.FrameworkName.consume_back(".framework"))
364+
break;
365+
HeaderPath.FrameworkParentDir = Path.substr(0, I - E);
367366
return HeaderPath;
368367
}
369368
Prev = I;
@@ -379,26 +378,27 @@ class SymbolCollector::HeaderFileURICache {
379378
// <Foundation/NSObject_Private.h> which should be used instead of directly
380379
// importing the header.
381380
std::optional<std::string>
382-
getFrameworkUmbrellaSpelling(llvm::StringRef Framework,
383-
const HeaderSearch &HS,
381+
getFrameworkUmbrellaSpelling(const HeaderSearch &HS,
384382
FrameworkHeaderPath &HeaderPath) {
383+
StringRef Framework = HeaderPath.FrameworkName;
385384
auto Res = CacheFrameworkToUmbrellaHeaderSpelling.try_emplace(Framework);
386385
auto *CachedSpelling = &Res.first->second;
387386
if (!Res.second) {
388387
return HeaderPath.IsPrivateHeader ? CachedSpelling->PrivateHeader
389388
: CachedSpelling->PublicHeader;
390389
}
391-
SmallString<256> UmbrellaPath(HeaderPath.HeadersParentDir);
392-
llvm::sys::path::append(UmbrellaPath, "Headers", Framework + ".h");
390+
SmallString<256> UmbrellaPath(HeaderPath.FrameworkParentDir);
391+
llvm::sys::path::append(UmbrellaPath, Framework + ".framework", "Headers",
392+
Framework + ".h");
393393

394394
llvm::vfs::Status Status;
395395
auto StatErr = HS.getFileMgr().getNoncachedStatValue(UmbrellaPath, Status);
396396
if (!StatErr)
397397
CachedSpelling->PublicHeader = llvm::formatv("<{0}/{0}.h>", Framework);
398398

399-
UmbrellaPath = HeaderPath.HeadersParentDir;
400-
llvm::sys::path::append(UmbrellaPath, "PrivateHeaders",
401-
Framework + "_Private.h");
399+
UmbrellaPath = HeaderPath.FrameworkParentDir;
400+
llvm::sys::path::append(UmbrellaPath, Framework + ".framework",
401+
"PrivateHeaders", Framework + "_Private.h");
402402

403403
StatErr = HS.getFileMgr().getNoncachedStatValue(UmbrellaPath, Status);
404404
if (!StatErr)
@@ -414,8 +414,7 @@ class SymbolCollector::HeaderFileURICache {
414414
// give <Foundation/Foundation.h> if the umbrella header exists, otherwise
415415
// <Foundation/NSObject.h>.
416416
std::optional<llvm::StringRef>
417-
getFrameworkHeaderIncludeSpelling(FileEntryRef FE, llvm::StringRef Framework,
418-
HeaderSearch &HS) {
417+
getFrameworkHeaderIncludeSpelling(FileEntryRef FE, HeaderSearch &HS) {
419418
auto Res = CachePathToFrameworkSpelling.try_emplace(FE.getName());
420419
auto *CachedHeaderSpelling = &Res.first->second;
421420
if (!Res.second)
@@ -429,13 +428,15 @@ class SymbolCollector::HeaderFileURICache {
429428
return std::nullopt;
430429
}
431430
if (auto UmbrellaSpelling =
432-
getFrameworkUmbrellaSpelling(Framework, HS, *HeaderPath)) {
431+
getFrameworkUmbrellaSpelling(HS, *HeaderPath)) {
433432
*CachedHeaderSpelling = *UmbrellaSpelling;
434433
return llvm::StringRef(*CachedHeaderSpelling);
435434
}
436435

437436
*CachedHeaderSpelling =
438-
llvm::formatv("<{0}/{1}>", Framework, HeaderPath->HeaderSubpath).str();
437+
llvm::formatv("<{0}/{1}>", HeaderPath->FrameworkName,
438+
HeaderPath->HeaderSubpath)
439+
.str();
439440
return llvm::StringRef(*CachedHeaderSpelling);
440441
}
441442

@@ -454,11 +455,8 @@ class SymbolCollector::HeaderFileURICache {
454455
// Framework headers are spelled as <FrameworkName/Foo.h>, not
455456
// "path/FrameworkName.framework/Headers/Foo.h".
456457
auto &HS = PP->getHeaderSearchInfo();
457-
if (const auto *HFI = HS.getExistingFileInfo(*FE))
458-
if (!HFI->Framework.empty())
459-
if (auto Spelling =
460-
getFrameworkHeaderIncludeSpelling(*FE, HFI->Framework, HS))
461-
return *Spelling;
458+
if (auto Spelling = getFrameworkHeaderIncludeSpelling(*FE, HS))
459+
return *Spelling;
462460

463461
if (!tooling::isSelfContainedHeader(*FE, PP->getSourceManager(),
464462
PP->getHeaderSearchInfo())) {

clang-tools-extra/test/clang-tidy/checkers/readability/function-cognitive-complexity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ void unittest_false() {
6969
//----------------------------------------------------------------------------//
7070

7171
// break does not increase cognitive complexity.
72-
// only break LABEL does, but it is unavaliable in C or C++
72+
// only break LABEL does, but it is unavailable in C or C++
7373

7474
// continue does not increase cognitive complexity.
75-
// only continue LABEL does, but it is unavaliable in C or C++
75+
// only continue LABEL does, but it is unavailable in C or C++
7676

7777
void unittest_b1_00() {
7878
// CHECK-NOTES: :[[@LINE-1]]:6: warning: function 'unittest_b1_00' has cognitive complexity of 33 (threshold 0) [readability-function-cognitive-complexity]

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: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
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

clang/bindings/python/tests/cindex/test_code_completion.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, 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
109
from pathlib import Path
1110

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: 12 additions & 13 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 {

0 commit comments

Comments
 (0)