Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7675fc7
[Flang] Move builtin .mod generation into runtimes (Reapply #137828) …
Meinersbur Dec 9, 2025
0768068
[VPlan] Remove ExtractLastLane for plans with scalar VFs. (#171145)
fhahn Dec 9, 2025
182a59d
[mlir][bufferization][NFC] Add convenience overload for `buildBufferD…
matthias-springer Dec 9, 2025
9c83428
[clang-tidy] Add missing Modernize module to Google module link libs …
vbvictor Dec 9, 2025
31c03c9
[lldb][docs] Fix plaintext marker in variables doc
DavidSpickett Dec 9, 2025
4e94198
[clangd] Remove the unused AST-based code folding Implementation. (#1…
hokein Dec 9, 2025
870aa89
[lldb][docs] Remove syntax hint from some output blocks
DavidSpickett Dec 9, 2025
95bd878
[llvm-mca][AArch64] Merge Neoverse NEON tests (NFC) (#170881)
c-rhodes Dec 9, 2025
2cb8e52
[lldb][docs] Fix plain text markers in Contributing
DavidSpickett Dec 9, 2025
afb3852
[lldb][docs] Fix title formatting in Variable document
DavidSpickett Dec 9, 2025
b1ef2db
[lldb][docs] Fix header level warnings in a few documents
DavidSpickett Dec 9, 2025
bf93440
[AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (#162077)
Pierre-vh Dec 9, 2025
1cbed4f
[NFC][AMDGPU] Remove unused TableGen generated enum (#171170)
mbrkusanin Dec 9, 2025
719d079
[mlir][tosa] Remove EXT_MXFP support for cast (#167301)
lhutton1 Dec 9, 2025
1b82c16
[FMV][AArch64] Allow user to override version priority. (#150267)
labrinea Dec 9, 2025
2766002
[AArch64]SIMD fpcvt codegen for rounding nodes (#165546)
Lukacma Dec 9, 2025
4572f4f
Revert "[AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (#1620…
Pierre-vh Dec 9, 2025
f90fe01
[OpenMP] Fix -Wparentheses warning [NFC]
mikaelholmen Dec 9, 2025
7f6c907
[mlir] Fix -Wparentheses warning [NFC]
mikaelholmen Dec 9, 2025
e3cf462
[MLIR] Apply clang-tidy fixes for llvm-else-after-return in LinalgTra…
joker-eph Aug 21, 2025
257417e
[MLIR] Apply clang-tidy fixes for readability-container-size-empty in…
joker-eph Aug 21, 2025
95e6edc
[MLIR] Apply clang-tidy fixes for performance-unnecessary-copy-initia…
joker-eph Aug 21, 2025
d478baa
Add more missing `LLVM_ABI` annotations (#168765)
Steelskin Dec 9, 2025
fe68fb6
[AArch64] Make the list of LSE supported operations explicit (#171126)
davemgreen Dec 9, 2025
734ea9a
[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in SelectObject…
joker-eph Aug 21, 2025
2f502f3
[Hexagon] Remove unnecessarily complicated helpers (NFC)
nikic Dec 9, 2025
bf41fd7
[Hexagon] Avoid unnecessary by reference passing (NFC)
nikic Dec 9, 2025
a6fa720
[Hexagon] Simplify creation of splat value (NFC)
nikic Dec 9, 2025
45267ec
[X86] Use getSigned() for segment offset
nikic Dec 9, 2025
bd8c063
[SjLjEHPrepare] Use getSigned() for call site number
nikic Dec 9, 2025
53ce850
[Bitcode] Use ConstantInt::getSigned()
nikic Dec 9, 2025
db59def
[ThumbRegisterInfo] Use getSigned() for constant pool loads
nikic Dec 9, 2025
7085552
merge main into amd-staging
ronlieb Dec 9, 2025
ea7f2a4
Revert "[Flang] Move builtin .mod generation into runtimes (Reapply #…
ronlieb Dec 9, 2025
bcb7fe9
merge main into amd-staging
ronlieb Dec 9, 2025
30547dd
[clang][FMV][AArch64] Remove O3 from failing test (#171457)
labrinea Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/google/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_clang_library(clangTidyGoogleModule STATIC

LINK_LIBS
clangTidy
clangTidyModernizeModule
clangTidyReadabilityModule
clangTidyUtils

Expand Down
78 changes: 0 additions & 78 deletions clang-tools-extra/clangd/SemanticSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,72 +42,6 @@ void addIfDistinct(const Range &R, std::vector<Range> &Result) {
}
}

std::optional<FoldingRange> toFoldingRange(SourceRange SR,
const SourceManager &SM) {
const auto Begin = SM.getDecomposedLoc(SR.getBegin()),
End = SM.getDecomposedLoc(SR.getEnd());
// Do not produce folding ranges if either range ends is not within the main
// file. Macros have their own FileID so this also checks if locations are not
// within the macros.
if ((Begin.first != SM.getMainFileID()) || (End.first != SM.getMainFileID()))
return std::nullopt;
FoldingRange Range;
Range.startCharacter = SM.getColumnNumber(Begin.first, Begin.second) - 1;
Range.startLine = SM.getLineNumber(Begin.first, Begin.second) - 1;
Range.endCharacter = SM.getColumnNumber(End.first, End.second) - 1;
Range.endLine = SM.getLineNumber(End.first, End.second) - 1;
return Range;
}

std::optional<FoldingRange>
extractFoldingRange(const syntax::Node *Node,
const syntax::TokenBufferTokenManager &TM) {
if (const auto *Stmt = dyn_cast<syntax::CompoundStatement>(Node)) {
const auto *LBrace = cast_or_null<syntax::Leaf>(
Stmt->findChild(syntax::NodeRole::OpenParen));
// FIXME(kirillbobyrev): This should find the last child. Compound
// statements have only one pair of braces so this is valid but for other
// node kinds it might not be correct.
const auto *RBrace = cast_or_null<syntax::Leaf>(
Stmt->findChild(syntax::NodeRole::CloseParen));
if (!LBrace || !RBrace)
return std::nullopt;
// Fold the entire range within braces, including whitespace.
const SourceLocation LBraceLocInfo =
TM.getToken(LBrace->getTokenKey())->endLocation(),
RBraceLocInfo =
TM.getToken(RBrace->getTokenKey())->location();
auto Range = toFoldingRange(SourceRange(LBraceLocInfo, RBraceLocInfo),
TM.sourceManager());
// Do not generate folding range for compound statements without any
// nodes and newlines.
if (Range && Range->startLine != Range->endLine)
return Range;
}
return std::nullopt;
}

// Traverse the tree and collect folding ranges along the way.
std::vector<FoldingRange>
collectFoldingRanges(const syntax::Node *Root,
const syntax::TokenBufferTokenManager &TM) {
std::queue<const syntax::Node *> Nodes;
Nodes.push(Root);
std::vector<FoldingRange> Result;
while (!Nodes.empty()) {
const syntax::Node *Node = Nodes.front();
Nodes.pop();
const auto Range = extractFoldingRange(Node, TM);
if (Range)
Result.push_back(*Range);
if (const auto *T = dyn_cast<syntax::Tree>(Node))
for (const auto *NextNode = T->getFirstChild(); NextNode;
NextNode = NextNode->getNextSibling())
Nodes.push(NextNode);
}
return Result;
}

} // namespace

llvm::Expected<SelectionRange> getSemanticRanges(ParsedAST &AST, Position Pos) {
Expand Down Expand Up @@ -230,18 +164,6 @@ class PragmaRegionFinder {
}
};

// FIXME(kirillbobyrev): Collect comments, PP conditional regions, includes and
// other code regions (e.g. public/private/protected sections of classes,
// control flow statement bodies).
// Related issue: https://github.com/clangd/clangd/issues/310
llvm::Expected<std::vector<FoldingRange>> getFoldingRanges(ParsedAST &AST) {
syntax::Arena A;
syntax::TokenBufferTokenManager TM(AST.getTokens(), AST.getLangOpts(),
AST.getSourceManager());
const auto *SyntaxTree = syntax::buildSyntaxTree(A, TM, AST.getASTContext());
return collectFoldingRanges(SyntaxTree, TM);
}

// FIXME( usaxena95): Collect includes and other code regions (e.g.
// public/private/protected sections of classes, control flow statement bodies).
// Related issue: https://github.com/clangd/clangd/issues/310
Expand Down
4 changes: 0 additions & 4 deletions clang-tools-extra/clangd/SemanticSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ namespace clangd {
/// If pos is not in any interesting range, return [Pos, Pos).
llvm::Expected<SelectionRange> getSemanticRanges(ParsedAST &AST, Position Pos);

/// Returns a list of ranges whose contents might be collapsible in an editor.
/// This should include large scopes, preprocessor blocks etc.
llvm::Expected<std::vector<FoldingRange>> getFoldingRanges(ParsedAST &AST);

/// Returns a list of ranges whose contents might be collapsible in an editor.
/// This version uses the pseudoparser which does not require the AST.
llvm::Expected<std::vector<FoldingRange>>
Expand Down
70 changes: 0 additions & 70 deletions clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,76 +196,6 @@ TEST(SemanticSelection, RunViaClangdServer) {
ElementsAre(SourceAnnotations.range("empty")));
}

TEST(FoldingRanges, ASTAll) {
const char *Tests[] = {
R"cpp(
#define FOO int foo() {\
int Variable = 42; \
return 0; \
}

// Do not generate folding range for braces within macro expansion.
FOO

// Do not generate folding range within macro arguments.
#define FUNCTOR(functor) functor
void func() {[[
FUNCTOR([](){});
]]}

// Do not generate folding range with a brace coming from macro.
#define LBRACE {
void bar() LBRACE
int X = 42;
}
)cpp",
R"cpp(
void func() {[[
int Variable = 100;

if (Variable > 5) {[[
Variable += 42;
]]} else if (Variable++)
++Variable;
else {[[
Variable--;
]]}

// Do not generate FoldingRange for empty CompoundStmts.
for (;;) {}

// If there are newlines between {}, we should generate one.
for (;;) {[[

]]}
]]}
)cpp",
R"cpp(
class Foo {
public:
Foo() {[[
int X = 1;
]]}

private:
int getBar() {[[
return 42;
]]}

// Braces are located at the same line: no folding range here.
void getFooBar() { }
};
)cpp",
};
for (const char *Test : Tests) {
auto T = Annotations(Test);
auto AST = TestTU::withCode(T.code()).build();
EXPECT_THAT(gatherFoldingRanges(llvm::cantFail(getFoldingRanges(AST))),
UnorderedElementsAreArray(T.ranges()))
<< Test;
}
}

TEST(FoldingRanges, PseudoParserWithoutLineFoldings) {
const char *Tests[] = {
R"cpp(
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -12945,6 +12945,12 @@ def warn_target_clone_duplicate_options
def warn_target_clone_no_impact_options
: Warning<"version list contains entries that don't impact code generation">,
InGroup<FunctionMultiVersioning>;
def warn_version_priority_out_of_range
: Warning<"version priority '%0' is outside the allowed range [1-255]; ignoring priority">,
InGroup<FunctionMultiVersioning>;
def warn_invalid_default_version_priority
: Warning<"priority of default version cannot be overridden; ignoring priority">,
InGroup<FunctionMultiVersioning>;

// three-way comparison operator diagnostics
def err_implied_comparison_category_type_not_found : Error<
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Sema/SemaARM.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class SemaARM : public SemaBase {
/// false otherwise.
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType);

bool checkTargetVersionAttr(const StringRef Str, const SourceLocation Loc);
bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc,
SmallString<64> &NewParam);
bool checkTargetClonesAttr(SmallVectorImpl<StringRef> &Params,
SmallVectorImpl<SourceLocation> &Locs,
SmallVectorImpl<SmallString<64>> &NewParams);
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Sema/SemaRISCV.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class SemaRISCV : public SemaBase {

std::unique_ptr<sema::RISCVIntrinsicManager> IntrinsicManager;

bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc);
bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc,
SmallString<64> &NewParam);
bool checkTargetClonesAttr(SmallVectorImpl<StringRef> &Params,
SmallVectorImpl<SourceLocation> &Locs,
SmallVectorImpl<SmallString<64>> &NewParams);
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/CodeGen/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,10 @@ void AArch64ABIInfo::appendAttributeMangling(StringRef AttrStr,

llvm::SmallDenseSet<StringRef, 8> UniqueFeats;
for (auto &Feat : Features)
if (auto Ext = llvm::AArch64::parseFMVExtension(Feat))
if (UniqueFeats.insert(Ext->Name).second)
Out << 'M' << Ext->Name;
if (getTarget().doesFeatureAffectCodeGen(Feat))
if (auto Ext = llvm::AArch64::parseFMVExtension(Feat))
if (UniqueFeats.insert(Ext->Name).second)
Out << 'M' << Ext->Name;
}

std::unique_ptr<TargetCodeGenInfo>
Expand Down
65 changes: 57 additions & 8 deletions clang/lib/Sema/SemaARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,19 +1593,54 @@ bool SemaARM::areLaxCompatibleSveTypes(QualType FirstType,
IsLaxCompatible(SecondType, FirstType);
}

static void appendFeature(StringRef Feat, SmallString<64> &Buffer) {
if (!Buffer.empty())
Buffer.append("+");
Buffer.append(Feat);
}

static void convertPriorityString(unsigned Priority,
SmallString<64> &NewParam) {
StringRef PriorityString[8] = {"P0", "P1", "P2", "P3",
"P4", "P5", "P6", "P7"};

assert(Priority > 0 && Priority < 256 && "priority out of range");
// Convert priority=[1-255] -> P0 + ... + P7
for (unsigned BitPos = 0; BitPos < 8; ++BitPos)
if (Priority & (1U << BitPos))
appendFeature(PriorityString[BitPos], NewParam);
}

bool SemaARM::checkTargetVersionAttr(const StringRef Param,
const SourceLocation Loc) {
const SourceLocation Loc,
SmallString<64> &NewParam) {
using namespace DiagAttrParams;

auto [LHS, RHS] = Param.split(';');
RHS = RHS.trim();
bool IsDefault = false;
llvm::SmallVector<StringRef, 8> Features;
Param.split(Features, '+');
LHS.split(Features, '+');
for (StringRef Feat : Features) {
Feat = Feat.trim();
if (Feat == "default")
continue;
if (!getASTContext().getTargetInfo().validateCpuSupports(Feat))
IsDefault = true;
else if (!getASTContext().getTargetInfo().validateCpuSupports(Feat))
return Diag(Loc, diag::warn_unsupported_target_attribute)
<< Unsupported << None << Feat << TargetVersion;
appendFeature(Feat, NewParam);
}

if (!RHS.empty() && RHS.consume_front("priority=")) {
if (IsDefault)
Diag(Loc, diag::warn_invalid_default_version_priority);
else {
unsigned Digit;
if (RHS.getAsInteger(0, Digit) || Digit < 1 || Digit > 255)
Diag(Loc, diag::warn_version_priority_out_of_range) << RHS;
else
convertPriorityString(Digit, NewParam);
}
}
return false;
}
Expand All @@ -1627,15 +1662,21 @@ bool SemaARM::checkTargetClonesAttr(
const StringRef Param = Params[I].trim();
const SourceLocation &Loc = Locs[I];

if (Param.empty())
auto [LHS, RHS] = Param.split(';');
RHS = RHS.trim();
bool HasPriority = !RHS.empty() && RHS.consume_front("priority=");

if (LHS.empty())
return Diag(Loc, diag::warn_unsupported_target_attribute)
<< Unsupported << None << "" << TargetClones;

if (Param == "default") {
if (LHS == "default") {
if (HasDefault)
Diag(Loc, diag::warn_target_clone_duplicate_options);
else {
NewParams.push_back(Param);
if (HasPriority)
Diag(Loc, diag::warn_invalid_default_version_priority);
NewParams.push_back(LHS);
HasDefault = true;
}
continue;
Expand All @@ -1644,7 +1685,7 @@ bool SemaARM::checkTargetClonesAttr(
bool HasCodeGenImpact = false;
llvm::SmallVector<StringRef, 8> Features;
llvm::SmallVector<StringRef, 8> ValidFeatures;
Param.split(Features, '+');
LHS.split(Features, '+');
for (StringRef Feat : Features) {
Feat = Feat.trim();
if (!getASTContext().getTargetInfo().validateCpuSupports(Feat)) {
Expand Down Expand Up @@ -1674,6 +1715,14 @@ bool SemaARM::checkTargetClonesAttr(
continue;
}

if (HasPriority) {
unsigned Digit;
if (RHS.getAsInteger(0, Digit) || Digit < 1 || Digit > 255)
Diag(Loc, diag::warn_version_priority_out_of_range) << RHS;
else
convertPriorityString(Digit, NewParam);
}

// Valid non-default argument.
NewParams.push_back(NewParam);
HasNonDefault = true;
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3445,19 +3445,20 @@ bool Sema::checkTargetAttr(SourceLocation LiteralLoc, StringRef AttrStr) {
static void handleTargetVersionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
StringRef Param;
SourceLocation Loc;
SmallString<64> NewParam;
if (!S.checkStringLiteralArgumentAttr(AL, 0, Param, &Loc))
return;

if (S.Context.getTargetInfo().getTriple().isAArch64()) {
if (S.ARM().checkTargetVersionAttr(Param, Loc))
if (S.ARM().checkTargetVersionAttr(Param, Loc, NewParam))
return;
} else if (S.Context.getTargetInfo().getTriple().isRISCV()) {
if (S.RISCV().checkTargetVersionAttr(Param, Loc))
if (S.RISCV().checkTargetVersionAttr(Param, Loc, NewParam))
return;
}

TargetVersionAttr *NewAttr =
::new (S.Context) TargetVersionAttr(S.Context, AL, Param);
::new (S.Context) TargetVersionAttr(S.Context, AL, NewParam);
D->addAttr(NewAttr);
}

Expand Down
4 changes: 3 additions & 1 deletion clang/lib/Sema/SemaRISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,8 @@ bool SemaRISCV::isValidFMVExtension(StringRef Ext) {
}

bool SemaRISCV::checkTargetVersionAttr(const StringRef Param,
const SourceLocation Loc) {
const SourceLocation Loc,
SmallString<64> &NewParam) {
using namespace DiagAttrParams;

llvm::SmallVector<StringRef, 8> AttrStrs;
Expand Down Expand Up @@ -1785,6 +1786,7 @@ bool SemaRISCV::checkTargetVersionAttr(const StringRef Param,
return Diag(Loc, diag::warn_unsupported_target_attribute)
<< Unsupported << None << Param << TargetVersion;

NewParam = Param;
return false;
}

Expand Down
Loading