Skip to content

Commit

Permalink
merge main into amd-staging
Browse files Browse the repository at this point in the history
Change-Id: Ifd9ad7faef742a6df848c22505a343ee74ff55b8
  • Loading branch information
Jenkins committed Nov 27, 2024
2 parents 49f849e + f67ba58 commit b251485
Show file tree
Hide file tree
Showing 90 changed files with 1,230 additions and 581 deletions.
5 changes: 3 additions & 2 deletions bolt/unittests/Core/MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ INSTANTIATE_TEST_SUITE_P(AArch64, MCPlusBuilderTester,
::testing::Values(Triple::aarch64));

TEST_P(MCPlusBuilderTester, AliasX0) {
uint64_t AliasesX0[] = {AArch64::W0, AArch64::X0, AArch64::W0_W1,
uint64_t AliasesX0[] = {AArch64::W0, AArch64::W0_HI,
AArch64::X0, AArch64::W0_W1,
AArch64::X0_X1, AArch64::X0_X1_X2_X3_X4_X5_X6_X7};
size_t AliasesX0Count = sizeof(AliasesX0) / sizeof(*AliasesX0);
testRegAliases(Triple::aarch64, AArch64::X0, AliasesX0, AliasesX0Count);
}

TEST_P(MCPlusBuilderTester, AliasSmallerX0) {
uint64_t AliasesX0[] = {AArch64::W0, AArch64::X0};
uint64_t AliasesX0[] = {AArch64::W0, AArch64::W0_HI, AArch64::X0};
size_t AliasesX0Count = sizeof(AliasesX0) / sizeof(*AliasesX0);
testRegAliases(Triple::aarch64, AArch64::X0, AliasesX0, AliasesX0Count, true);
}
Expand Down
30 changes: 0 additions & 30 deletions clang-tools-extra/CODE_OWNERS.TXT

This file was deleted.

75 changes: 75 additions & 0 deletions clang-tools-extra/Maintainers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
=============================
Clang Tools Extra Maintainers
=============================

This file is a list of the maintainers
(https://llvm.org/docs/DeveloperPolicy.html#maintainers) for clang-tools-extra.


Active Maintainers
==================
The following people are the active maintainers for the project. Please reach
out to them for code reviews, questions about their area of expertise, or other
assistance.

Lead Maintainer
---------------
| Aaron Ballman
| [email protected] (email), aaron.ballman (Phabricator), AaronBallman (GitHub), AaronBallman (Discourse), aaronballman (Discord), AaronBallman (IRC)


clang-tidy
----------
| Congcong Cai
| [email protected] (email), HerrCai0907 (GitHub), HerrCai0907 (Discourse)

| Julian Schmidt
| [email protected] (email), 5chmidti (GitHub), 5chmidti (Discourse), 5chmidti (Discord)

| Piotr Zegar
| [email protected] (email), PiotrZSL (GitHub), PiotrZSL (Discourse), PiotrZSL (Discord)


clang-query
-----------
| Aaron Ballman
| [email protected] (email), aaron.ballman (Phabricator), AaronBallman (GitHub), AaronBallman (Discourse), aaronballman (Discord), AaronBallman (IRC)


clang-doc
---------
| Paul Kirth
| [email protected] (email), ilovepi (GitHub), ilovepi (Discourse)

| Peter Chou
| [email protected] (email), PeterChou1 (GitHub), PeterChou1 (Discourse), .peterchou (Discord)


clangd
------
| Nathan Ridge
| [email protected] (email), HighCommander4 (GitHub), HighCommander4 (Discourse), nridge (Discord)

| Chris Bieneman
| [email protected] (email), llvm-beanz (GitHub), beanz (Discord), beanz (Discourse)

| Kadir Çetinkaya
| [email protected] (email), kadircet (GitHub) kadircet (Discourse), kadircet (Discord)


Inactive Maintainers
====================
The following people have graciously spent time performing maintainership
responsibilities but are no longer active in that role. Thank you for all your
help with the success of the project!

Emeritus Lead Maintainers
-------------------------
| Manuel Klimek ([email protected] (email), r4nt (GitHub))


Inactive component maintainers
------------------------------
| Nathan James ([email protected]) -- clang-tidy
| Julie Hockett ([email protected]) -- clang-doc
| Sam McCall ([email protected] (email), sam-mccall (GitHub, Discourse, Discord)) -- clangd
4 changes: 4 additions & 0 deletions clang/include/clang/Analysis/FlowSensitive/ASTOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ struct ReferencedDecls {
/// Free functions and member functions which are referenced (but not
/// necessarily called).
llvm::DenseSet<const FunctionDecl *> Functions;
/// When analyzing a lambda's call operator, the set of all parameters (from
/// the surrounding function) that the lambda captures. Captured local
/// variables are already included in `Locals` above.
llvm::DenseSet<const ParmVarDecl *> LambdaCapturedParams;
};

/// Returns declarations that are declared in or referenced from `FD`.
Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/Basic/DiagnosticASTKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ def err_module_odr_violation_field : Error<
"%select{"
"field %4|"
"field %4 with type %5|"
"%select{non-|}5bitfield %4|"
"bitfield %4 with one width expression|"
"%select{non-|}5bit-field %4|"
"bit-field %4 with one width expression|"
"%select{non-|}5mutable field %4|"
"field %4 with %select{no|an}5 initializer|"
"field %4 with an initializer"
Expand All @@ -793,8 +793,8 @@ def note_module_odr_violation_field : Note<
"%select{"
"field %3|"
"field %3 with type %4|"
"%select{non-|}4bitfield %3|"
"bitfield %3 with different width expression|"
"%select{non-|}4bit-field %3|"
"bit-field %3 with different width expression|"
"%select{non-|}4mutable field %3|"
"field %3 with %select{no|an}4 initializer|"
"field %3 with a different initializer"
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -6417,7 +6417,7 @@ def warn_signed_bitfield_enum_conversion : Warning<
"enumerators of %1">,
InGroup<BitFieldEnumConversion>, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;
"consider making the bit-field type %select{unsigned|signed}0">;

def warn_missing_braces : Warning<
"suggest braces around initialization of subobject">,
Expand Down
23 changes: 23 additions & 0 deletions clang/lib/Analysis/FlowSensitive/ASTOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

#include "clang/Analysis/FlowSensitive/ASTOps.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ComputeDependence.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
Expand Down Expand Up @@ -282,6 +283,28 @@ ReferencedDecls getReferencedDecls(const FunctionDecl &FD) {
if (const auto *CtorDecl = dyn_cast<CXXConstructorDecl>(&FD))
Visitor.traverseConstructorInits(CtorDecl);

// If analyzing a lambda call operator, collect all captures of parameters (of
// the surrounding function). This collects them even if they are not
// referenced in the body of the lambda call operator. Non-parameter local
// variables that are captured are already collected into
// `ReferencedDecls.Locals` when traversing the call operator body, but we
// collect parameters here to avoid needing to check at each referencing node
// whether the parameter is a lambda capture from a surrounding function or is
// a parameter of the current function. If it becomes necessary to limit this
// set to the parameters actually referenced in the body, alternative
// optimizations can be implemented to minimize duplicative work.
if (const auto *Method = dyn_cast<CXXMethodDecl>(&FD);
Method && isLambdaCallOperator(Method)) {
for (const auto &Capture : Method->getParent()->captures()) {
if (Capture.capturesVariable()) {
if (const auto *Param =
dyn_cast<ParmVarDecl>(Capture.getCapturedVar())) {
Result.LambdaCapturedParams.insert(Param);
}
}
}
}

return Result;
}

Expand Down
9 changes: 5 additions & 4 deletions clang/lib/Sema/SemaOpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,10 +961,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitAttachClause(

OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
SemaOpenACC::OpenACCParsedClause &Clause) {
// Restrictions only properly implemented on 'compute' constructs, and
// 'compute' constructs are the only construct that can do anything with
// this yet, so skip/treat as unimplemented in this case.
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
// Restrictions only properly implemented on 'compute'/'combined' constructs,
// and 'compute'/'combined' constructs are the only construct that can do
// anything with this yet, so skip/treat as unimplemented in this case.
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
return isNotImplemented();

// ActOnVar ensured that everything is a valid variable reference, but we
Expand Down
32 changes: 23 additions & 9 deletions clang/lib/StaticAnalyzer/Core/BugReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,28 @@ PathSensitiveBugReport::getRanges() const {
return Ranges;
}

static bool exitingDestructor(const ExplodedNode *N) {
// Need to loop here, as some times the Error node is already outside of the
// destructor context, and the previous node is an edge that is also outside.
while (N && !N->getLocation().getAs<StmtPoint>()) {
N = N->getFirstPred();
}
return N && isa<CXXDestructorDecl>(N->getLocationContext()->getDecl());
}

static const Stmt *
findReasonableStmtCloseToFunctionExit(const ExplodedNode *N) {
if (exitingDestructor(N)) {
// If we are exiting a destructor call, it is more useful to point to
// the next stmt which is usually the temporary declaration.
if (const Stmt *S = N->getNextStmtForDiagnostics())
return S;
// If next stmt is not found, it is likely the end of a top-level
// function analysis. find the last execution statement then.
}
return N->getPreviousStmtForDiagnostics();
}

PathDiagnosticLocation
PathSensitiveBugReport::getLocation() const {
assert(ErrorNode && "Cannot create a location with a null node.");
Expand All @@ -2433,15 +2455,7 @@ PathSensitiveBugReport::getLocation() const {
if (const ReturnStmt *RS = FE->getStmt())
return PathDiagnosticLocation::createBegin(RS, SM, LC);

// If we are exiting a destructor call, it is more useful to point to the
// next stmt which is usually the temporary declaration.
// For non-destructor and non-top-level calls, the next stmt will still
// refer to the last executed stmt of the body.
S = ErrorNode->getNextStmtForDiagnostics();
// If next stmt is not found, it is likely the end of a top-level function
// analysis. find the last execution statement then.
if (!S)
S = ErrorNode->getPreviousStmtForDiagnostics();
S = findReasonableStmtCloseToFunctionExit(ErrorNode);
}
if (!S)
S = ErrorNode->getNextStmtForDiagnostics();
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ const Stmt *ExplodedNode::getStmtForDiagnostics() const {

const Stmt *ExplodedNode::getNextStmtForDiagnostics() const {
for (const ExplodedNode *N = getFirstSucc(); N; N = N->getFirstSucc()) {
if (N->getLocation().isPurgeKind())
continue;
if (const Stmt *S = N->getStmtForDiagnostics()) {
// Check if the statement is '?' or '&&'/'||'. These are "merges",
// not actual statement points.
Expand Down
9 changes: 7 additions & 2 deletions clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,19 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) {
ExplodedNodeSet CleanedNodes;
if (LastSt && Blk && AMgr.options.AnalysisPurgeOpt != PurgeNone) {
static SimpleProgramPointTag retValBind("ExprEngine", "Bind Return Value");
PostStmt Loc(LastSt, calleeCtx, &retValBind);
auto Loc = isa<ReturnStmt>(LastSt)
? ProgramPoint{PostStmt(LastSt, calleeCtx, &retValBind)}
: ProgramPoint{EpsilonPoint(calleeCtx, /*Data1=*/nullptr,
/*Data2=*/nullptr, &retValBind)};
const CFGBlock *PrePurgeBlock =
isa<ReturnStmt>(LastSt) ? Blk : &CEBNode->getCFG().getExit();
bool isNew;
ExplodedNode *BindedRetNode = G.getNode(Loc, state, false, &isNew);
BindedRetNode->addPredecessor(CEBNode, G);
if (!isNew)
return;

NodeBuilderContext Ctx(getCoreEngine(), Blk, BindedRetNode);
NodeBuilderContext Ctx(getCoreEngine(), PrePurgeBlock, BindedRetNode);
currBldrCtx = &Ctx;
// Here, we call the Symbol Reaper with 0 statement and callee location
// context, telling it to clean up everything in the callee's context
Expand Down
6 changes: 6 additions & 0 deletions clang/test/AST/ast-print-openacc-combined-construct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,10 @@ void foo() {
// CHECK: #pragma acc kernels loop present(i, array[1], array, array[1:2])
#pragma acc kernels loop present(i, array[1], array, array[1:2])
for(int i = 0;i<5;++i);

float *arrayPtr[5];

// CHECK: #pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
#pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
for(int i = 0;i<5;++i);
}
10 changes: 5 additions & 5 deletions clang/test/Analysis/copy-elision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,17 @@ void testVariable() {

struct TestCtorInitializer {
ClassWithDestructor c;
TestCtorInitializer(AddressVector<ClassWithDestructor> &v)
: c(ClassWithDestructor(v)) {}
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'ClassWithDestructor' is still referred \
to by the caller variable 'v' upon returning to the caller}}
TestCtorInitializer(AddressVector<ClassWithDestructor> &refParam)
: c(ClassWithDestructor(refParam)) {}
};

void testCtorInitializer() {
AddressVector<ClassWithDestructor> v;
{
TestCtorInitializer t(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'ClassWithDestructor' is still referred \
to by the caller variable 'v' upon returning to the caller}}
// Check if the last destructor is an automatic destructor.
// A temporary destructor would have fired by now.
#if ELIDE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ class UnguardedFieldThroughMethodTest {
Volume = 0;
break;
case A:
Area = 0; // expected-warning {{1 uninitialized field}}
break;
Area = 0;
break; // expected-warning {{1 uninitialized field}}
}
}

Expand Down Expand Up @@ -201,8 +201,8 @@ class UnguardedPublicFieldsTest {
Volume = 0;
break;
case A:
Area = 0; // expected-warning {{1 uninitialized field}}
break;
Area = 0;
break; // expected-warning {{1 uninitialized field}}
}
}

Expand Down
26 changes: 26 additions & 0 deletions clang/test/Analysis/void-call-exit-modelling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -analyzer-output text -verify %s

typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t size);

void inf_loop_break_callee() {
void* data = malloc(10); // expected-note{{Memory is allocated}}
while (1) { // expected-note{{Loop condition is true}}
(void)data;
break; // No note that we jump to the line above from this break
} // expected-note@-1{{Execution jumps to the end of the function}}
} // expected-warning{{Potential leak of memory pointed to by 'data'}}
// expected-note@-1 {{Potential leak of memory pointed to by 'data'}}

void inf_loop_break_caller() {
inf_loop_break_callee(); // expected-note{{Calling 'inf_loop_break_callee'}}
}

void inf_loop_break_top() {
void* data = malloc(10); // expected-note{{Memory is allocated}}
while (1) { // expected-note{{Loop condition is true}}
(void)data;
break; // No note that we jump to the line above from this break
} // expected-note@-1{{Execution jumps to the end of the function}}
} // expected-warning{{Potential leak of memory pointed to by 'data'}}
// expected-note@-1 {{Potential leak of memory pointed to by 'data'}}
Loading

0 comments on commit b251485

Please sign in to comment.