Skip to content

Commit 4254e18

Browse files
committed
merge main into amd-staging
Change-Id: I1c4714267394ac520de85619cf99fb9275b43293
2 parents 83d0ba9 + 133197a commit 4254e18

File tree

142 files changed

+8129
-13842
lines changed

Some content is hidden

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

142 files changed

+8129
-13842
lines changed

clang/docs/APINotes.rst

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ entries:
8080

8181
Name: MyFramework
8282

83-
:Classes, Protocols, Tags, Typedefs, Globals, Enumerators, Functions:
83+
:Classes, Protocols, Tags, Typedefs, Globals, Enumerators, Functions, Namespaces:
8484

8585
Arrays of top-level declarations. Each entry in the array must have a
86-
'Name' key with its Objective-C name. "Tags" refers to structs, enums, and
87-
unions; "Enumerators" refers to enum cases.
86+
'Name' key with its Objective-C or C++ name. "Tags" refers to structs,
87+
C++ classes, enums, and unions; "Classes" refers to Objective-C classes;
88+
"Enumerators" refers to enum cases.
8889

8990
::
9091

@@ -157,6 +158,36 @@ declaration kind), all of which are optional:
157158
- Class: NSBundle
158159
SwiftName: Bundle
159160

161+
:SwiftImportAs:
162+
163+
For a class, possible values are ``owned`` (equivalent to
164+
``SWIFT_SELF_CONTAINED``) or ``reference`` (equivalent to
165+
``SWIFT_SHARED_REFERENCE``, also requires specifying ``SwiftReleaseOp`` and
166+
``SwiftRetainOp``).
167+
168+
For a method, possible values are ``unsafe`` (equivalent
169+
to ``SWIFT_RETURNS_INDEPENDENT_VALUE``) or ``computed_property`` (equivalent to
170+
``SWIFT_COMPUTED_PROPERTY``).
171+
172+
::
173+
174+
Tags:
175+
- Name: RefCountedStorage
176+
SwiftImportAs: reference
177+
SwiftReleaseOp: RCRelease
178+
SwiftRetainOp: RCRetain
179+
180+
:SwiftCopyable:
181+
182+
Allows annotating a C++ class as non-copyable in Swift. Equivalent to
183+
``SWIFT_NONCOPYABLE``, or to an explicit conformance ``: ~Copyable``.
184+
185+
::
186+
187+
Tags:
188+
- Name: tzdb
189+
SwiftCopyable: false
190+
160191
:Availability, AvailabilityMsg:
161192

162193
A value of "nonswift" is equivalent to ``NS_SWIFT_UNAVAILABLE``. A value of

clang/docs/analyzer/checkers.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,21 +2452,6 @@ Check for pointer subtractions on two pointers pointing to different memory chun
24522452
int d = &y - &x; // warn
24532453
}
24542454
2455-
.. _alpha-core-SizeofPtr:
2456-
2457-
alpha.core.SizeofPtr (C)
2458-
""""""""""""""""""""""""
2459-
Warn about unintended use of ``sizeof()`` on pointer expressions.
2460-
2461-
.. code-block:: c
2462-
2463-
struct s {};
2464-
2465-
int test(struct s *p) {
2466-
return sizeof(p);
2467-
// warn: sizeof(ptr) can produce an unexpected result
2468-
}
2469-
24702455
.. _alpha-core-StackAddressAsyncEscape:
24712456
24722457
alpha.core.StackAddressAsyncEscape (C)

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ def PointerSubChecker : Checker<"PointerSub">,
296296
"different memory chunks">,
297297
Documentation<HasDocumentation>;
298298

299-
def SizeofPointerChecker : Checker<"SizeofPtr">,
300-
HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
301-
Documentation<HasDocumentation>;
302-
303299
def TestAfterDivZeroChecker : Checker<"TestAfterDivZero">,
304300
HelpText<"Check for division by variable that is later compared against 0. "
305301
"Either the comparison is useless or there is division by zero.">,

clang/lib/AST/ASTStructuralEquivalence.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@ class StmtComparer {
348348
return true;
349349
}
350350

351+
bool IsStmtEquivalent(const CXXDependentScopeMemberExpr *E1,
352+
const CXXDependentScopeMemberExpr *E2) {
353+
if (!IsStructurallyEquivalent(Context, E1->getMember(), E2->getMember())) {
354+
return false;
355+
}
356+
return IsStructurallyEquivalent(Context, E1->getBaseType(),
357+
E2->getBaseType());
358+
}
359+
351360
bool IsStmtEquivalent(const UnaryExprOrTypeTraitExpr *E1,
352361
const UnaryExprOrTypeTraitExpr *E2) {
353362
if (E1->getKind() != E2->getKind())
@@ -1997,7 +2006,10 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
19972006
}
19982007
return false;
19992008
}
2000-
2009+
if (!Context.IgnoreTemplateParmDepth && D1->getDepth() != D2->getDepth())
2010+
return false;
2011+
if (D1->getIndex() != D2->getIndex())
2012+
return false;
20012013
// Check types.
20022014
if (!IsStructurallyEquivalent(Context, D1->getType(), D2->getType())) {
20032015
if (Context.Complain) {

clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ add_clang_library(clangStaticAnalyzerCheckers
2424
CheckObjCInstMethSignature.cpp
2525
CheckPlacementNew.cpp
2626
CheckSecuritySyntaxOnly.cpp
27-
CheckSizeofPointer.cpp
2827
CheckerDocumentation.cpp
2928
ChrootChecker.cpp
3029
CloneChecker.cpp

clang/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp

Lines changed: 0 additions & 96 deletions
This file was deleted.

clang/test/Analysis/sizeofpointer.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/unittests/AST/StructuralEquivalenceTest.cpp

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,34 @@ TEST_F(StructuralEquivalenceCacheTest, VarDeclWithDifferentStorageClassNoEq) {
18771877
EXPECT_FALSE(Ctx.IsEquivalent(Var.first, Var.second));
18781878
}
18791879

1880+
TEST_F(StructuralEquivalenceCacheTest,
1881+
NonTypeTemplateParmWithDifferentPositionNoEq) {
1882+
auto TU = makeTuDecls(
1883+
R"(
1884+
template<int T>
1885+
struct A {
1886+
template<int U>
1887+
void foo() {}
1888+
};
1889+
)",
1890+
R"(
1891+
template<int U>
1892+
struct A {
1893+
template<int V, int T>
1894+
void foo() {}
1895+
};
1896+
)",
1897+
Lang_CXX03);
1898+
1899+
StructuralEquivalenceContext Ctx(
1900+
get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(),
1901+
NonEquivalentDecls, StructuralEquivalenceKind::Default, false, false);
1902+
1903+
auto NTTP = findDeclPair<NonTypeTemplateParmDecl>(
1904+
TU, nonTypeTemplateParmDecl(hasName("T")));
1905+
EXPECT_FALSE(Ctx.IsEquivalent(NTTP.first, NTTP.second));
1906+
}
1907+
18801908
TEST_F(StructuralEquivalenceCacheTest, VarDeclWithInitNoEq) {
18811909
auto TU = makeTuDecls(
18821910
R"(
@@ -2441,8 +2469,7 @@ TEST_F(StructuralEquivalenceStmtTest, NonTypeTemplateParm) {
24412469
void foo(A<T, y>);
24422470
)",
24432471
Lang_CXX11);
2444-
// FIXME: These should not match,
2445-
EXPECT_TRUE(testStructuralMatch(t));
2472+
EXPECT_FALSE(testStructuralMatch(t));
24462473
}
24472474

24482475
TEST_F(StructuralEquivalenceStmtTest, UnresolvedLookupDifferentName) {
@@ -2595,5 +2622,31 @@ TEST_F(StructuralEquivalenceStmtTest, DeclRefExpr) {
25952622
EXPECT_FALSE(testStructuralMatch(t));
25962623
}
25972624

2625+
TEST_F(StructuralEquivalenceCacheTest, CXXDependentScopeMemberExprNoEq) {
2626+
auto S = makeStmts(
2627+
R"(
2628+
template <class T>
2629+
void foo() {
2630+
(void)T().x;
2631+
}
2632+
struct A { int x; };
2633+
void bar() {
2634+
foo<A>();
2635+
}
2636+
)",
2637+
R"(
2638+
template <class T>
2639+
void foo() {
2640+
(void)T().y;
2641+
}
2642+
struct A { int y; };
2643+
void bar() {
2644+
foo<A>();
2645+
}
2646+
)",
2647+
Lang_CXX11, cxxDependentScopeMemberExpr());
2648+
EXPECT_FALSE(testStructuralMatch(S));
2649+
}
2650+
25982651
} // end namespace ast_matchers
25992652
} // end namespace clang

clang/www/analyzer/alpha_checks.html

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,6 @@ <h3 id="core_alpha_checkers">Core Alpha Checkers</h3>
239239
</pre></div></div></td></tr>
240240

241241

242-
<tr><td><a id="alpha.core.SizeofPtr"><div class="namedescr expandable"><span class="name">
243-
alpha.core.SizeofPtr</span><span class="lang">
244-
(C)</span><div class="descr">
245-
Warn about unintended use of <code>sizeof()</code> on pointer
246-
expressions.</div></div></a></td>
247-
<td><div class="exampleContainer expandable">
248-
<div class="example"><pre>
249-
struct s {};
250-
251-
int test(struct s *p) {
252-
return sizeof(p);
253-
// warn: sizeof(ptr) can produce an unexpected result
254-
}
255-
</pre></div></div></td></tr>
256-
257-
258242
<tr><td><a id="alpha.core.StackAddressAsyncEscape"><div class="namedescr expandable"><span class="name">
259243
alpha.core.StackAddressAsyncEscape</span><span class="lang">
260244
(C)</span><div class="descr">

flang/include/flang/Lower/PFTBuilder.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@
3131

3232
namespace Fortran::lower::pft {
3333

34+
struct CompilerDirectiveUnit;
3435
struct Evaluation;
35-
struct Program;
36-
struct ModuleLikeUnit;
3736
struct FunctionLikeUnit;
37+
struct ModuleLikeUnit;
38+
struct Program;
3839

40+
using ContainedUnit = std::variant<CompilerDirectiveUnit, FunctionLikeUnit>;
41+
using ContainedUnitList = std::list<ContainedUnit>;
3942
using EvaluationList = std::list<Evaluation>;
4043

4144
/// Provide a variant like container that can hold references. It can hold
@@ -594,8 +597,8 @@ VariableList getDependentVariableList(const Fortran::semantics::Symbol &);
594597

595598
void dump(VariableList &, std::string s = {}); // `s` is an optional dump label
596599

597-
/// Function-like units may contain evaluations (executable statements) and
598-
/// nested function-like units (internal procedures and function statements).
600+
/// Function-like units may contain evaluations (executable statements),
601+
/// directives, and internal (nested) function-like units.
599602
struct FunctionLikeUnit : public ProgramUnit {
600603
// wrapper statements for function-like syntactic structures
601604
using FunctionStatement =
@@ -697,10 +700,10 @@ struct FunctionLikeUnit : public ProgramUnit {
697700
std::optional<FunctionStatement> beginStmt;
698701
FunctionStatement endStmt;
699702
const semantics::Scope *scope;
700-
EvaluationList evaluationList;
701703
LabelEvalMap labelEvaluationMap;
702704
SymbolLabelMap assignSymbolLabelMap;
703-
std::list<FunctionLikeUnit> nestedFunctions;
705+
ContainedUnitList containedUnitList;
706+
EvaluationList evaluationList;
704707
/// <Symbol, Evaluation> pairs for each entry point. The pair at index 0
705708
/// is the primary entry point; remaining pairs are alternate entry points.
706709
/// The primary entry point symbol is Null for an anonymous program.
@@ -746,7 +749,7 @@ struct ModuleLikeUnit : public ProgramUnit {
746749

747750
ModuleStatement beginStmt;
748751
ModuleStatement endStmt;
749-
std::list<FunctionLikeUnit> nestedFunctions;
752+
ContainedUnitList containedUnitList;
750753
EvaluationList evaluationList;
751754
};
752755

0 commit comments

Comments
 (0)