Skip to content

Commit 3a55cfc

Browse files
committed
Merge branch 'main' into hidden_visibility
2 parents 525dc0e + 6e988bd commit 3a55cfc

File tree

564 files changed

+29962
-8760
lines changed

Some content is hidden

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

564 files changed

+29962
-8760
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ FilterMemProfile("filter-mem-profile",
6161
cl::init(true),
6262
cl::cat(AggregatorCategory));
6363

64+
static cl::opt<bool> ParseMemProfile(
65+
"parse-mem-profile",
66+
cl::desc("enable memory profile parsing if it's present in the input data, "
67+
"on by default unless `--itrace` is set."),
68+
cl::init(true), cl::cat(AggregatorCategory));
69+
6470
static cl::opt<unsigned long long>
6571
FilterPID("pid",
6672
cl::desc("only use samples from process with specified PID"),
@@ -181,6 +187,10 @@ void DataAggregator::start() {
181187
"script -F pid,event,ip",
182188
/*Wait = */false);
183189
} else if (!opts::ITraceAggregation.empty()) {
190+
// Disable parsing memory profile from trace data, unless requested by user.
191+
if (!opts::ParseMemProfile.getNumOccurrences())
192+
opts::ParseMemProfile = false;
193+
184194
std::string ItracePerfScriptArgs = llvm::formatv(
185195
"script -F pid,brstack --itrace={0}", opts::ITraceAggregation);
186196
launchPerfProcess("branch events with itrace", MainEventsPPI,
@@ -191,12 +201,9 @@ void DataAggregator::start() {
191201
/*Wait = */ false);
192202
}
193203

194-
// Note: we launch script for mem events regardless of the option, as the
195-
// command fails fairly fast if mem events were not collected.
196-
launchPerfProcess("mem events",
197-
MemEventsPPI,
198-
"script -F pid,event,addr,ip",
199-
/*Wait = */false);
204+
if (opts::ParseMemProfile)
205+
launchPerfProcess("mem events", MemEventsPPI, "script -F pid,event,addr,ip",
206+
/*Wait = */ false);
200207

201208
launchPerfProcess("process events", MMapEventsPPI,
202209
"script --show-mmap-events --no-itrace",
@@ -217,7 +224,8 @@ void DataAggregator::abort() {
217224
sys::Wait(TaskEventsPPI.PI, 1, &Error);
218225
sys::Wait(MMapEventsPPI.PI, 1, &Error);
219226
sys::Wait(MainEventsPPI.PI, 1, &Error);
220-
sys::Wait(MemEventsPPI.PI, 1, &Error);
227+
if (opts::ParseMemProfile)
228+
sys::Wait(MemEventsPPI.PI, 1, &Error);
221229

222230
deleteTempFiles();
223231

@@ -506,7 +514,8 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
506514
errs() << "PERF2BOLT: failed to parse samples\n";
507515

508516
// Special handling for memory events
509-
if (!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
517+
if (opts::ParseMemProfile &&
518+
!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
510519
if (const std::error_code EC = parseMemEvents())
511520
errs() << "PERF2BOLT: failed to parse memory events: " << EC.message()
512521
<< '\n';

clang-tools-extra/clangd/unittests/HoverTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ class Foo final {})cpp";
974974
HI.Name = "abc";
975975
HI.Kind = index::SymbolKind::Variable;
976976
HI.NamespaceScope = "";
977-
HI.Definition = "int abc = <recovery - expr>()";
977+
HI.Definition = "int abc";
978978
HI.Type = "int";
979979
HI.AccessSpecifier = "public";
980980
}},

clang-tools-extra/clangd/unittests/XRefsTests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,14 @@ TEST(FindReferences, WithinAST) {
23112311
$(S::deleteObject)[[de^lete]] S;
23122312
}
23132313
};
2314+
)cpp",
2315+
// Array designators
2316+
R"cpp(
2317+
const int $def[[F^oo]] = 0;
2318+
int Bar[] = {
2319+
[$(Bar)[[F^oo]]...$(Bar)[[Fo^o]] + 1] = 0,
2320+
[$(Bar)[[^Foo]] + 2] = 1
2321+
};
23142322
)cpp"};
23152323
for (const char *Test : Tests)
23162324
checkFindRefs(Test);

clang/docs/HIPSupport.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
HIP Support
1818
=============
1919

20-
HIP (Heterogeneous-Compute Interface for Portability) `<https://github.com/ROCm-Developer-Tools/HIP>`_ is
20+
HIP (Heterogeneous-Compute Interface for Portability) `<https://github.com/ROCm/HIP>`_ is
2121
a C++ Runtime API and Kernel Language. It enables developers to create portable applications for
2222
offloading computation to different hardware platforms from a single source code.
2323

@@ -41,9 +41,9 @@ backend or the out-of-tree LLVM-SPIRV translator. The SPIR-V is then bundled and
4141
.. note::
4242
While Clang does not directly provide HIP support for NVIDIA GPUs and CPUs, these platforms are supported via other means:
4343

44-
- NVIDIA GPUs: HIP support is offered through the HIP project `<https://github.com/ROCm-Developer-Tools/HIP>`_, which provides a header-only library for translating HIP runtime APIs into CUDA runtime APIs. The code is subsequently compiled using NVIDIA's `nvcc`.
44+
- NVIDIA GPUs: HIP support is offered through the HIP project `<https://github.com/ROCm/HIP>`_, which provides a header-only library for translating HIP runtime APIs into CUDA runtime APIs. The code is subsequently compiled using NVIDIA's `nvcc`.
4545

46-
- CPUs: HIP support is available through the HIP-CPU runtime library `<https://github.com/ROCm-Developer-Tools/HIP-CPU>`_. This header-only library enables CPUs to execute unmodified HIP code.
46+
- CPUs: HIP support is available through the HIP-CPU runtime library `<https://github.com/ROCm/HIP-CPU>`_. This header-only library enables CPUs to execute unmodified HIP code.
4747

4848

4949
Example Usage
@@ -328,7 +328,7 @@ The `parallel_unsequenced_policy <https://en.cppreference.com/w/cpp/algorithm/ex
328328
maps relatively well to the execution model of AMD GPUs. This, coupled with the
329329
the availability and maturity of GPU accelerated algorithm libraries that
330330
implement most / all corresponding algorithms in the standard library
331-
(e.g. `rocThrust <https://github.com/ROCmSoftwarePlatform/rocThrust>`__), makes
331+
(e.g. `rocThrust <https://github.com/ROCm/rocm-libraries/tree/develop/projects/rocthrust>`__), makes
332332
it feasible to provide seamless accelerator offload for supported algorithms,
333333
when an accelerated version exists. Thus, it becomes possible to easily access
334334
the computational resources of an AMD accelerator, via a well specified,
@@ -483,7 +483,7 @@ such as GPUs, work.
483483
allocation / deallocation functions with accelerator-aware equivalents,
484484
based on a pre-established table; the list of functions that can be
485485
interposed is available
486-
`here <https://github.com/ROCmSoftwarePlatform/roc-stdpar#allocation--deallocation-interposition-status>`__;
486+
`here <https://github.com/ROCm/roc-stdpar#allocation--deallocation-interposition-status>`__;
487487
- This is only run when compiling for the host.
488488

489489
The second pass is optional.
@@ -627,7 +627,7 @@ Linux operating system. Support is synthesised in the following table:
627627
The minimum Linux kernel version for running in HMM mode is 6.4.
628628

629629
The forwarding header can be obtained from
630-
`its GitHub repository <https://github.com/ROCmSoftwarePlatform/roc-stdpar>`_.
630+
`its GitHub repository <https://github.com/ROCm/roc-stdpar>`_.
631631
It will be packaged with a future `ROCm <https://rocm.docs.amd.com/en/latest/>`_
632632
release. Because accelerated algorithms are provided via
633633
`rocThrust <https://rocm.docs.amd.com/projects/rocThrust/en/latest/>`_, a
@@ -636,7 +636,7 @@ transitive dependency on
636636
can be obtained either by installing their associated components of the
637637
`ROCm <https://rocm.docs.amd.com/en/latest/>`_ stack, or from their respective
638638
repositories. The list algorithms that can be offloaded is available
639-
`here <https://github.com/ROCmSoftwarePlatform/roc-stdpar#algorithm-support-status>`_.
639+
`here <https://github.com/ROCm/roc-stdpar#algorithm-support-status>`_.
640640

641641
HIP Specific Elements
642642
---------------------

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ Improvements to Clang's diagnostics
622622

623623
- Improved the FixIts for unused lambda captures.
624624

625+
- Delayed typo correction was removed from the compiler; immediate typo
626+
correction behavior remains the same. Delayed typo correction facilities were
627+
fragile and unmaintained, and the removal closed the following issues:
628+
#GH142457, #GH139913, #GH138850, #GH137867, #GH137860, #GH107840, #GH93308,
629+
#GH69470, #GH59391, #GH58172, #GH46215, #GH45915, #GH45891, #GH44490,
630+
#GH36703, #GH32903, #GH23312, #GH69874.
631+
632+
625633
Improvements to Clang's time-trace
626634
----------------------------------
627635

clang/include/clang/AST/Expr.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ class Expr : public ValueStmt {
240240
return static_cast<bool>(getDependence() & ExprDependence::UnexpandedPack);
241241
}
242242

243-
/// Whether this expression contains subexpressions which had errors, e.g. a
244-
/// TypoExpr.
243+
/// Whether this expression contains subexpressions which had errors.
245244
bool containsErrors() const {
246245
return static_cast<bool>(getDependence() & ExprDependence::Error);
247246
}
@@ -6965,36 +6964,6 @@ class AtomicExpr : public Expr {
69656964
}
69666965
};
69676966

6968-
/// TypoExpr - Internal placeholder for expressions where typo correction
6969-
/// still needs to be performed and/or an error diagnostic emitted.
6970-
class TypoExpr : public Expr {
6971-
// The location for the typo name.
6972-
SourceLocation TypoLoc;
6973-
6974-
public:
6975-
TypoExpr(QualType T, SourceLocation TypoLoc)
6976-
: Expr(TypoExprClass, T, VK_LValue, OK_Ordinary), TypoLoc(TypoLoc) {
6977-
assert(T->isDependentType() && "TypoExpr given a non-dependent type");
6978-
setDependence(ExprDependence::TypeValueInstantiation |
6979-
ExprDependence::Error);
6980-
}
6981-
6982-
child_range children() {
6983-
return child_range(child_iterator(), child_iterator());
6984-
}
6985-
const_child_range children() const {
6986-
return const_child_range(const_child_iterator(), const_child_iterator());
6987-
}
6988-
6989-
SourceLocation getBeginLoc() const LLVM_READONLY { return TypoLoc; }
6990-
SourceLocation getEndLoc() const LLVM_READONLY { return TypoLoc; }
6991-
6992-
static bool classof(const Stmt *T) {
6993-
return T->getStmtClass() == TypoExprClass;
6994-
}
6995-
6996-
};
6997-
69986967
/// This class represents BOTH the OpenMP Array Section and OpenACC 'subarray',
69996968
/// with a boolean differentiator.
70006969
/// OpenMP 5.0 [2.1.5, Array Sections].

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2956,7 +2956,6 @@ DEF_TRAVERSE_STMT(CXXRewrittenBinaryOperator, {
29562956
}
29572957
})
29582958
DEF_TRAVERSE_STMT(OpaqueValueExpr, {})
2959-
DEF_TRAVERSE_STMT(TypoExpr, {})
29602959
DEF_TRAVERSE_STMT(RecoveryExpr, {})
29612960
DEF_TRAVERSE_STMT(CUDAKernelCallExpr, {})
29622961

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,9 @@ def UniqueObjectDuplication : DiagGroup<"unique-object-duplication"> {
806806
Warns when objects which are supposed to be globally unique might get duplicated
807807
when built into a shared library.
808808

809-
If an object with hidden visibility is built into a shared library, each instance
809+
This can occur to objects which are hidden from the dynamic linker, due to
810+
having hidden visibility (on posix) or lacking a dllimport/dllexport attribute
811+
(on windows). If such an object is built into a shared library, each instance
810812
of the library will get its own copy. This can cause very subtle bugs if there was
811813
only supposed to be one copy of the object in question: singletons aren't single,
812814
changes to one object won't affect the others, the object's initializer will run
@@ -815,7 +817,7 @@ once per copy, etc.
815817
Specifically, this warning fires when it detects an object which:
816818
1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
817819
2. Has external linkage (otherwise it's supposed to be duplicated), and
818-
3. Has hidden visibility.
820+
3. Has hidden visibility (posix) or lacks a dllimport/dllexport attribute (windows).
819821

820822
As well as one of the following:
821823
1. The object is mutable, or
@@ -825,13 +827,15 @@ The warning can be resolved by removing one of the conditions above. In rough
825827
order of preference, this may be done by:
826828
1. Marking the object ``const`` (if possible)
827829
2. Moving the object's definition to a source file
828-
3. Giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
830+
3. Making the object visible using ``__attribute((visibility("default")))``,
831+
``__declspec(dllimport)``, or ``__declspec(dllexport)``.
832+
833+
When annotating an object with ``__declspec(dllimport)`` or ``__declspec(dllexport)``,
834+
take care to ensure that the object is only exported from one dll, and is imported
835+
everywhere else.
829836

830837
Note that for (2), all levels of a pointer variable must be constant;
831838
``const int*`` will trigger the warning because the pointer itself is mutable.
832-
833-
This warning is not yet implemented for Windows, since Windows uses
834-
import/export rules instead of visibility.
835839
}];
836840
}
837841

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,8 @@ def note_unsatisfied_trait
17671767
: Note<"%0 is not %enum_select<TraitName>{"
17681768
"%TriviallyRelocatable{trivially relocatable}|"
17691769
"%Replaceable{replaceable}|"
1770-
"%TriviallyCopyable{trivially copyable}"
1770+
"%TriviallyCopyable{trivially copyable}|"
1771+
"%Constructible{constructible with provided types}"
17711772
"}1">;
17721773

17731774
def note_unsatisfied_trait_reason
@@ -1797,7 +1798,10 @@ def note_unsatisfied_trait_reason
17971798
"%DeletedAssign{has a deleted %select{copy|move}1 "
17981799
"assignment operator}|"
17991800
"%UnionWithUserDeclaredSMF{is a union with a user-declared "
1800-
"%sub{select_special_member_kind}1}"
1801+
"%sub{select_special_member_kind}1}|"
1802+
"%FunctionType{is a function type}|"
1803+
"%CVVoidType{is a cv void type}|"
1804+
"%IncompleteArrayType{is an incomplete array type}"
18011805
"}0">;
18021806

18031807
def warn_consteval_if_always_true : Warning<
@@ -6263,14 +6267,19 @@ def warn_static_local_in_extern_inline : Warning<
62636267
def note_convert_inline_to_static : Note<
62646268
"use 'static' to give inline function %0 internal linkage">;
62656269

6266-
def warn_possible_object_duplication_mutable : Warning<
6267-
"%0 may be duplicated when built into a shared library: "
6268-
"it is mutable, has hidden visibility, and external linkage">,
6269-
InGroup<UniqueObjectDuplication>, DefaultIgnore;
6270-
def warn_possible_object_duplication_init : Warning<
6271-
"initialization of %0 may run twice when built into a shared library: "
6272-
"it has hidden visibility and external linkage">,
6273-
InGroup<UniqueObjectDuplication>, DefaultIgnore;
6270+
def warn_possible_object_duplication_mutable
6271+
: Warning<"%0 may be duplicated when built into a shared library: "
6272+
"it is mutable, with external linkage and "
6273+
"%select{hidden visibility|no import/export annotation}1">,
6274+
InGroup<UniqueObjectDuplication>,
6275+
DefaultIgnore;
6276+
def warn_possible_object_duplication_init
6277+
: Warning<"initialization of %0 may run twice when built into a shared "
6278+
"library: "
6279+
"it has external linkage and "
6280+
"%select{hidden visibility|no import/export annotation}1">,
6281+
InGroup<UniqueObjectDuplication>,
6282+
DefaultIgnore;
62746283

62756284
def ext_redefinition_of_typedef : ExtWarn<
62766285
"redefinition of typedef %0 is a C11 feature">,

clang/include/clang/Basic/StmtNodes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ def ShuffleVectorExpr : StmtNode<Expr>;
202202
def ConvertVectorExpr : StmtNode<Expr>;
203203
def BlockExpr : StmtNode<Expr>;
204204
def OpaqueValueExpr : StmtNode<Expr>;
205-
def TypoExpr : StmtNode<Expr>;
206205
def RecoveryExpr : StmtNode<Expr>;
207206
def BuiltinBitCastExpr : StmtNode<ExplicitCastExpr>;
208207
def EmbedExpr : StmtNode<Expr>;

0 commit comments

Comments
 (0)