Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 401ed9d

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:95a4d30b0d64 into amd-gfx:e579a32bca2b
Local branch amd-gfx e579a32 Merged main:874b4fb6adf7 into amd-gfx:d19b7c1048e4 Remote branch main 95a4d30 [NFC] Remove trailing white spaces in `clang/docs/ReleaseNotes.rst`
2 parents e579a32 + 95a4d30 commit 401ed9d

File tree

94 files changed

+6585
-450
lines changed

Some content is hidden

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

94 files changed

+6585
-450
lines changed

clang/docs/ClangFormat.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
4949
supported:
5050
CSharp: .cs
5151
Java: .java
52-
JavaScript: .mjs .js .ts
52+
JavaScript: .js .mjs .cjs .ts
5353
Json: .json
5454
Objective-C: .m .mm
5555
Proto: .proto .protodevel

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Resolutions to C++ Defect Reports
310310
by default.
311311
(`CWG2521: User-defined literals and reserved identifiers <https://cplusplus.github.io/CWG/issues/2521.html>`_).
312312

313-
- Fix name lookup for a dependent base class that is the current instantiation.
313+
- Fix name lookup for a dependent base class that is the current instantiation.
314314
(`CWG591: When a dependent base class is the current instantiation <https://cplusplus.github.io/CWG/issues/591.html>`_).
315315

316316
C Language Changes
@@ -971,6 +971,8 @@ AST Matchers
971971
- Ensure ``hasName`` matches template specializations across inline namespaces,
972972
making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent.
973973

974+
- Improved the performance of the ``getExpansionLocOfMacro`` by tracking already processed macros during recursion.
975+
974976
- Add ``exportDecl`` matcher to match export declaration.
975977

976978
clang-format

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,12 +1786,12 @@ defm debug_info_for_profiling : BoolFOption<"debug-info-for-profiling",
17861786
PosFlag<SetTrue, [], [ClangOption, CC1Option],
17871787
"Emit extra debug info to make sample profile more accurate">,
17881788
NegFlag<SetFalse>>;
1789-
def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">,
1789+
def fprofile_generate_cold_function_coverage : Flag<["-"], "fprofile-generate-cold-function-coverage">,
17901790
Group<f_Group>, Visibility<[ClangOption, CLOption]>,
17911791
HelpText<"Generate instrumented code to collect coverage info for cold functions into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
1792-
def fprofile_generate_cold_function_coverage_EQ : Joined<["-"], "fprofile-generate-cold-function-coverage=">,
1792+
def fprofile_generate_cold_function_coverage_EQ : Joined<["-"], "fprofile-generate-cold-function-coverage=">,
17931793
Group<f_Group>, Visibility<[ClangOption, CLOption]>, MetaVarName<"<directory>">,
1794-
HelpText<"Generate instrumented code to collect coverage info for cold functions into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
1794+
HelpText<"Generate instrumented code to collect coverage info for cold functions into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
17951795
def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,
17961796
Group<f_Group>, Visibility<[ClangOption, CLOption]>,
17971797
HelpText<"Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;

clang/lib/ASTMatchers/ASTMatchersInternal.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "clang/Basic/LLVM.h"
2222
#include "clang/Lex/Lexer.h"
2323
#include "llvm/ADT/ArrayRef.h"
24+
#include "llvm/ADT/DenseSet.h"
2425
#include "llvm/ADT/IntrusiveRefCntPtr.h"
2526
#include "llvm/ADT/SmallString.h"
2627
#include "llvm/ADT/SmallVector.h"
@@ -697,27 +698,42 @@ static bool isTokenAtLoc(const SourceManager &SM, const LangOptions &LangOpts,
697698
return !Invalid && Text == TokenText;
698699
}
699700

700-
std::optional<SourceLocation>
701-
getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc,
702-
const ASTContext &Context) {
701+
static std::optional<SourceLocation> getExpansionLocOfMacroRecursive(
702+
StringRef MacroName, SourceLocation Loc, const ASTContext &Context,
703+
llvm::DenseSet<SourceLocation> &CheckedLocations) {
703704
auto &SM = Context.getSourceManager();
704705
const LangOptions &LangOpts = Context.getLangOpts();
705706
while (Loc.isMacroID()) {
707+
if (CheckedLocations.count(Loc))
708+
return std::nullopt;
709+
CheckedLocations.insert(Loc);
706710
SrcMgr::ExpansionInfo Expansion =
707711
SM.getSLocEntry(SM.getFileID(Loc)).getExpansion();
708-
if (Expansion.isMacroArgExpansion())
712+
if (Expansion.isMacroArgExpansion()) {
709713
// Check macro argument for an expansion of the given macro. For example,
710714
// `F(G(3))`, where `MacroName` is `G`.
711-
if (std::optional<SourceLocation> ArgLoc = getExpansionLocOfMacro(
712-
MacroName, Expansion.getSpellingLoc(), Context))
715+
if (std::optional<SourceLocation> ArgLoc =
716+
getExpansionLocOfMacroRecursive(MacroName,
717+
Expansion.getSpellingLoc(),
718+
Context, CheckedLocations)) {
713719
return ArgLoc;
720+
}
721+
}
714722
Loc = Expansion.getExpansionLocStart();
715723
if (isTokenAtLoc(SM, LangOpts, MacroName, Loc))
716724
return Loc;
717725
}
718726
return std::nullopt;
719727
}
720728

729+
std::optional<SourceLocation>
730+
getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc,
731+
const ASTContext &Context) {
732+
llvm::DenseSet<SourceLocation> CheckedLocations;
733+
return getExpansionLocOfMacroRecursive(MacroName, Loc, Context,
734+
CheckedLocations);
735+
}
736+
721737
std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
722738
llvm::Regex::RegexFlags Flags,
723739
StringRef MatcherID) {

clang/lib/Format/Format.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,6 +3950,7 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
39503950
return FormatStyle::LK_Java;
39513951
if (FileName.ends_with_insensitive(".js") ||
39523952
FileName.ends_with_insensitive(".mjs") ||
3953+
FileName.ends_with_insensitive(".cjs") ||
39533954
FileName.ends_with_insensitive(".ts")) {
39543955
return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript.
39553956
}

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static cl::opt<std::string> AssumeFileName(
8787
"supported:\n"
8888
" CSharp: .cs\n"
8989
" Java: .java\n"
90-
" JavaScript: .mjs .js .ts\n"
90+
" JavaScript: .js .mjs .cjs .ts\n"
9191
" Json: .json\n"
9292
" Objective-C: .m .mm\n"
9393
" Proto: .proto .protodevel\n"

clang/tools/clang-format/git-clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def main():
9494
# Other languages that clang-format supports
9595
'proto', 'protodevel', # Protocol Buffers
9696
'java', # Java
97-
'mjs', 'js', # JavaScript
97+
'js', 'mjs', 'cjs', # JavaScript
9898
'ts', # TypeScript
9999
'cs', # C Sharp
100100
'json', # Json

flang/unittests/Runtime/CommandTest.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,6 @@ TEST_F(ZeroArguments, ECLGeneralErrorCommandErrorSync) {
352352
#if defined(_WIN32)
353353
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 6);
354354
CheckDescriptorEqStr(cmdMsg.get(), "Invalid command lineXXXXXXXXX");
355-
#elif defined(_AIX)
356-
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 6);
357-
CheckDescriptorEqStr(cmdMsg.get(), "Invalid command lineXXXXXXXXX");
358355
#else
359356
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 3);
360357
CheckDescriptorEqStr(cmdMsg.get(), "Command line execution failed");

libc/src/__support/OSUtil/linux/exit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "src/__support/OSUtil/linux/syscall.h" // syscall_impl
910
#include "src/__support/common.h"
1011
#include "src/__support/macros/config.h"
11-
#include "syscall.h" // For internal syscall function.
1212
#include <sys/syscall.h> // For syscall numbers.
1313

1414
namespace LIBC_NAMESPACE_DECL {

lld/ELF/Arch/AArch64.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
154154
case R_AARCH64_MOVW_UABS_G3:
155155
return R_ABS;
156156
case R_AARCH64_AUTH_ABS64:
157-
return R_AARCH64_AUTH;
157+
return RE_AARCH64_AUTH;
158158
case R_AARCH64_TLSDESC_ADR_PAGE21:
159-
return R_AARCH64_TLSDESC_PAGE;
159+
return RE_AARCH64_TLSDESC_PAGE;
160160
case R_AARCH64_TLSDESC_LD64_LO12:
161161
case R_AARCH64_TLSDESC_ADD_LO12:
162162
return R_TLSDESC;
@@ -198,15 +198,15 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
198198
return R_PC;
199199
case R_AARCH64_ADR_PREL_PG_HI21:
200200
case R_AARCH64_ADR_PREL_PG_HI21_NC:
201-
return R_AARCH64_PAGE_PC;
201+
return RE_AARCH64_PAGE_PC;
202202
case R_AARCH64_LD64_GOT_LO12_NC:
203203
case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
204204
return R_GOT;
205205
case R_AARCH64_LD64_GOTPAGE_LO15:
206-
return R_AARCH64_GOT_PAGE;
206+
return RE_AARCH64_GOT_PAGE;
207207
case R_AARCH64_ADR_GOT_PAGE:
208208
case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
209-
return R_AARCH64_GOT_PAGE_PC;
209+
return RE_AARCH64_GOT_PAGE_PC;
210210
case R_AARCH64_GOTPCREL32:
211211
case R_AARCH64_GOT_LD_PREL19:
212212
return R_GOT_PC;
@@ -222,7 +222,7 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
222222
RelExpr AArch64::adjustTlsExpr(RelType type, RelExpr expr) const {
223223
if (expr == R_RELAX_TLS_GD_TO_IE) {
224224
if (type == R_AARCH64_TLSDESC_ADR_PAGE21)
225-
return R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC;
225+
return RE_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC;
226226
return R_RELAX_TLS_GD_TO_IE_ABS;
227227
}
228228
return expr;
@@ -877,7 +877,7 @@ bool AArch64Relaxer::tryRelaxAdrpLdr(const Relocation &adrpRel,
877877
if (val != llvm::SignExtend64(val, 33))
878878
return false;
879879

880-
Relocation adrpSymRel = {R_AARCH64_PAGE_PC, R_AARCH64_ADR_PREL_PG_HI21,
880+
Relocation adrpSymRel = {RE_AARCH64_PAGE_PC, R_AARCH64_ADR_PREL_PG_HI21,
881881
adrpRel.offset, /*addend=*/0, &sym};
882882
Relocation addRel = {R_ABS, R_AARCH64_ADD_ABS_LO12_NC, ldrRel.offset,
883883
/*addend=*/0, &sym};
@@ -922,21 +922,21 @@ void AArch64::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
922922
}
923923

924924
switch (rel.expr) {
925-
case R_AARCH64_GOT_PAGE_PC:
925+
case RE_AARCH64_GOT_PAGE_PC:
926926
if (i + 1 < size &&
927927
relaxer.tryRelaxAdrpLdr(rel, sec.relocs()[i + 1], secAddr, buf)) {
928928
++i;
929929
continue;
930930
}
931931
break;
932-
case R_AARCH64_PAGE_PC:
932+
case RE_AARCH64_PAGE_PC:
933933
if (i + 1 < size &&
934934
relaxer.tryRelaxAdrpAdd(rel, sec.relocs()[i + 1], secAddr, buf)) {
935935
++i;
936936
continue;
937937
}
938938
break;
939-
case R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC:
939+
case RE_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC:
940940
case R_RELAX_TLS_GD_TO_IE_ABS:
941941
relaxTlsGdToIe(loc, rel, val);
942942
continue;

0 commit comments

Comments
 (0)