Skip to content

Commit 30b2fde

Browse files
authored
Merge branch 'main' into inbelic/rs-sema-source-loc
2 parents a4018bb + 5a95ec6 commit 30b2fde

File tree

1,305 files changed

+141753
-18995
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,305 files changed

+141753
-18995
lines changed

.clang-tidy

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner'
1+
Checks: >
2+
-*,
3+
clang-diagnostic-*,
4+
llvm-*,
5+
misc-*,
6+
-misc-const-correctness,
7+
-misc-include-cleaner,
8+
-misc-no-recursion,
9+
-misc-non-private-member-variables-in-classes,
10+
-misc-unused-parameters,
11+
-misc-use-anonymous-namespace,
12+
readability-identifier-naming
13+
214
CheckOptions:
315
- key: readability-identifier-naming.ClassCase
416
value: CamelCase

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/library/ubuntu:24.04 as base
22
ENV LLVM_SYSROOT=/opt/llvm
33

44
FROM base as stage1-toolchain
5-
ENV LLVM_VERSION=20.1.4
5+
ENV LLVM_VERSION=20.1.8
66

77
RUN apt-get update && \
88
apt-get install -y \

.github/workflows/pr-code-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install clang-format
5656
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
5757
with:
58-
clangformat: 20.1.5
58+
clangformat: 20.1.8
5959

6060
- name: Setup Python env
6161
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0

.github/workflows/premerge.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
6464
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
6565
- name: Upload Artifacts
66+
if: '!cancelled()'
6667
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
6768
with:
6869
name: Premerge Artifacts (Linux)
@@ -113,6 +114,7 @@ jobs:
113114
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
114115
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
115116
- name: Upload Artifacts
117+
if: '!cancelled()'
116118
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
117119
with:
118120
name: Premerge Artifacts (Windows)

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ static llvm::Error parseRecord(const Record &R, unsigned ID,
180180
return decodeRecord(R, I->TagType, Blob);
181181
case RECORD_IS_TYPE_DEF:
182182
return decodeRecord(R, I->IsTypeDef, Blob);
183+
case RECORD_MANGLED_NAME:
184+
return decodeRecord(R, I->MangledName, Blob);
183185
default:
184186
return llvm::createStringError(llvm::inconvertibleErrorCode(),
185187
"invalid field for RecordInfo");

clang-tools-extra/clang-doc/BitcodeWriter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static const llvm::IndexedMap<RecordIdDsc, RecordIdToIndexFunctor>
189189
{RECORD_LOCATION, {"Location", &genLocationAbbrev}},
190190
{RECORD_TAG_TYPE, {"TagType", &genIntAbbrev}},
191191
{RECORD_IS_TYPE_DEF, {"IsTypeDef", &genBoolAbbrev}},
192+
{RECORD_MANGLED_NAME, {"MangledName", &genStringAbbrev}},
192193
{BASE_RECORD_USR, {"USR", &genSymbolIdAbbrev}},
193194
{BASE_RECORD_NAME, {"Name", &genStringAbbrev}},
194195
{BASE_RECORD_PATH, {"Path", &genStringAbbrev}},
@@ -271,7 +272,8 @@ static const std::vector<std::pair<BlockId, std::vector<RecordId>>>
271272
// Record Block
272273
{BI_RECORD_BLOCK_ID,
273274
{RECORD_USR, RECORD_NAME, RECORD_PATH, RECORD_DEFLOCATION,
274-
RECORD_LOCATION, RECORD_TAG_TYPE, RECORD_IS_TYPE_DEF}},
275+
RECORD_LOCATION, RECORD_TAG_TYPE, RECORD_IS_TYPE_DEF,
276+
RECORD_MANGLED_NAME}},
275277
// BaseRecord Block
276278
{BI_BASE_RECORD_BLOCK_ID,
277279
{BASE_RECORD_USR, BASE_RECORD_NAME, BASE_RECORD_PATH,
@@ -616,6 +618,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo &I) {
616618
emitRecord(I.USR, RECORD_USR);
617619
emitRecord(I.Name, RECORD_NAME);
618620
emitRecord(I.Path, RECORD_PATH);
621+
emitRecord(I.MangledName, RECORD_MANGLED_NAME);
619622
for (const auto &N : I.Namespace)
620623
emitBlock(N, FieldId::F_namespace);
621624
for (const auto &CI : I.Description)

clang-tools-extra/clang-doc/BitcodeWriter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ enum RecordId {
126126
RECORD_LOCATION,
127127
RECORD_TAG_TYPE,
128128
RECORD_IS_TYPE_DEF,
129+
RECORD_MANGLED_NAME,
129130
BASE_RECORD_USR,
130131
BASE_RECORD_NAME,
131132
BASE_RECORD_PATH,

clang-tools-extra/clang-doc/JSONGenerator.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj,
386386
Obj["FullName"] = I.FullName;
387387
Obj["TagType"] = getTagType(I.TagType);
388388
Obj["IsTypedef"] = I.IsTypeDef;
389+
Obj["MangledName"] = I.MangledName;
389390

390391
if (!I.Children.Functions.empty()) {
391392
json::Value PubFunctionsArray = Array();
@@ -491,6 +492,23 @@ static void serializeInfo(const NamespaceInfo &I, json::Object &Obj,
491492
serializeCommonChildren(I.Children, Obj, RepositoryUrl);
492493
}
493494

495+
static SmallString<16> determineFileName(Info *I, SmallString<128> &Path) {
496+
SmallString<16> FileName;
497+
if (I->IT == InfoType::IT_record) {
498+
auto *RecordSymbolInfo = static_cast<SymbolInfo *>(I);
499+
if (RecordSymbolInfo->MangledName.size() < 255)
500+
FileName = RecordSymbolInfo->MangledName;
501+
else
502+
FileName = toStringRef(toHex(RecordSymbolInfo->USR));
503+
} else if (I->IT == InfoType::IT_namespace && I->Name != "")
504+
// Serialize the global namespace as index.json
505+
FileName = I->Name;
506+
else
507+
FileName = I->getFileBaseName();
508+
sys::path::append(Path, FileName + ".json");
509+
return FileName;
510+
}
511+
494512
Error JSONGenerator::generateDocs(
495513
StringRef RootDir, llvm::StringMap<std::unique_ptr<doc::Info>> Infos,
496514
const ClangDocContext &CDCtx) {
@@ -501,15 +519,14 @@ Error JSONGenerator::generateDocs(
501519

502520
SmallString<128> Path;
503521
sys::path::native(RootDir, Path);
504-
sys::path::append(Path, Info->getRelativeFilePath(""));
505522
if (!CreatedDirs.contains(Path)) {
506523
if (std::error_code Err = sys::fs::create_directories(Path);
507524
Err != std::error_code())
508525
return createFileError(Twine(Path), Err);
509526
CreatedDirs.insert(Path);
510527
}
511528

512-
sys::path::append(Path, Info->getFileBaseName() + ".json");
529+
SmallString<16> FileName = determineFileName(Info, Path);
513530
FileToInfos[Path].push_back(Info);
514531
}
515532

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ void SymbolInfo::merge(SymbolInfo &&Other) {
290290
auto *Last = llvm::unique(Loc);
291291
Loc.erase(Last, Loc.end());
292292
mergeBase(std::move(Other));
293+
if (MangledName.empty())
294+
MangledName = std::move(Other.MangledName);
293295
}
294296

295297
NamespaceInfo::NamespaceInfo(SymbolID USR, StringRef Name, StringRef Path)

clang-tools-extra/clang-doc/Representation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ struct SymbolInfo : public Info {
377377

378378
std::optional<Location> DefLoc; // Location where this decl is defined.
379379
llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
380+
SmallString<16> MangledName;
380381
bool IsStatic = false;
381382
};
382383

0 commit comments

Comments
 (0)