Skip to content

Commit fef3d7b

Browse files
committed
Merge remote-tracking branch 'upstream/release/17.x' into rustc/17.0-2023-09-19
2 parents febc397 + 309d551 commit fef3d7b

File tree

67 files changed

+1278
-119
lines changed

Some content is hidden

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

67 files changed

+1278
-119
lines changed

.github/workflows/release-tasks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
./llvm/utils/release/github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} upload --files *doxygen*.tar.xz
5151
5252
- name: Create Release Notes Artifact
53-
uses: actions/download-artifact@v3
53+
uses: actions/upload-artifact@v3
5454
with:
5555
name: release-notes
5656
path: docs-build/html-export/
@@ -106,16 +106,18 @@ jobs:
106106
run: |
107107
cd llvm/utils/lit
108108
# Remove 'dev' suffix from lit version.
109-
sed -i "s/ + 'dev'//g" lit/__init__.py
109+
sed -i 's/ + "dev"//g' lit/__init__.py
110110
python3 setup.py sdist
111111
112112
- name: Upload lit to test.pypi.org
113113
uses: pypa/gh-action-pypi-publish@release/v1
114114
with:
115115
password: ${{ secrets.LLVM_LIT_TEST_PYPI_API_TOKEN }}
116116
repository-url: https://test.pypi.org/legacy/
117+
packages-dir: llvm/utils/lit/dist/
117118

118119
- name: Upload lit to pypi.org
119120
uses: pypa/gh-action-pypi-publish@release/v1
120121
with:
121122
password: ${{ secrets.LLVM_LIT_PYPI_API_TOKEN }}
123+
packages-dir: llvm/utils/lit/dist/

clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct UnqualNameVisitor : public RecursiveASTVisitor<UnqualNameVisitor> {
103103

104104
bool VisitDeclRefExpr(DeclRefExpr *S) {
105105
DeclarationName Name = S->getNameInfo().getName();
106-
return S->getQualifierLoc() || !Name.isIdentifier() ||
106+
return S->getQualifierLoc() || Name.isEmpty() || !Name.isIdentifier() ||
107107
!visitUnqualName(Name.getAsIdentifierInfo()->getName());
108108
}
109109

clang-tools-extra/clangd/TidyProvider.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
219219
"-bugprone-use-after-move",
220220
// Alias for bugprone-use-after-move.
221221
"-hicpp-invalid-access-moved",
222+
// Check uses dataflow analysis, which might hang/crash unexpectedly on
223+
// incomplete code.
224+
"-bugprone-unchecked-optional-access",
222225

223226
// ----- Performance problems -----
224227

clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,21 @@ struct TestDefaultOperatorB {
9898
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
9999
// CHECK-FIXES: {{^}} friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default;{{$}}
100100
};
101+
102+
namespace PR69863 {
103+
104+
template <unsigned Len>
105+
struct CustomCompileTimeString {
106+
constexpr CustomCompileTimeString(const char (&)[Len]) noexcept {}
107+
};
108+
109+
template <CustomCompileTimeString Str>
110+
constexpr decltype(Str) operator""__csz() noexcept {
111+
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
112+
// CHECK-FIXES: {{^}}constexpr auto operator""__csz() noexcept -> decltype(Str) {
113+
return Str;
114+
}
115+
116+
inline constexpr CustomCompileTimeString SomeString = "This line will cause a crash"__csz;
117+
118+
}

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ Improvements to Clang's diagnostics
394394
(`#62353: <https://github.com/llvm/llvm-project/issues/62353>`_,
395395
fallout from the non-POD packing ABI fix in LLVM 15).
396396
- Clang constexpr evaluator now prints subobject's name instead of its type in notes
397-
when a constexpr variable has uninitialized subobjects after its constructor call.
397+
when a constexpr variable has uninitialized member subobjects or base class subobjects
398+
after its constructor call.
398399
(`#58601 <https://github.com/llvm/llvm-project/issues/58601>`_)
399400
- Clang's `-Wshadow` warning now warns about shadowings by static local variables
400401
(`#62850: <https://github.com/llvm/llvm-project/issues/62850>`_).
@@ -719,6 +720,12 @@ Bug Fixes in This Version
719720
points (i.e., uses function descriptor objects instead).
720721
- Fixes a ``clang-17`` regression where ``LLVM_UNREACHABLE_OPTIMIZE=OFF``
721722
cannot be used with ``Release`` mode builds. (`#68237 <https://github.com/llvm/llvm-project/issues/68237>`_).
723+
- Fix crash from constexpr evaluator evaluating uninitialized arrays as rvalue.
724+
Fixes (`#67317 <https://github.com/llvm/llvm-project/issues/67317>`_)
725+
- No longer use C++ ``thread_local`` semantics in C23 when using
726+
``thread_local`` instead of ``_Thread_local``.
727+
Fixes (`#70068 <https://github.com/llvm/llvm-project/issues/70068>`_) and
728+
(`#69167 <https://github.com/llvm/llvm-project/issues/69167>`_)
722729

723730
Bug Fixes to Compiler Builtins
724731
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def note_consteval_address_accessible : Note<
6969
"%select{pointer|reference}0 to a consteval declaration "
7070
"is not a constant expression">;
7171
def note_constexpr_uninitialized : Note<
72-
"subobject %0 is not initialized">;
72+
"subobject %select{of type |}0%1 is not initialized">;
7373
def note_constexpr_uninitialized_base : Note<
7474
"constructor of base class %0 is not called">;
7575
def note_constexpr_static_local : Note<

clang/lib/AST/ExprConstant.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,10 +2379,15 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
23792379
const FieldDecl *SubobjectDecl,
23802380
CheckedTemporaries &CheckedTemps) {
23812381
if (!Value.hasValue()) {
2382-
assert(SubobjectDecl && "SubobjectDecl shall be non-null");
2383-
Info.FFDiag(DiagLoc, diag::note_constexpr_uninitialized) << SubobjectDecl;
2384-
Info.Note(SubobjectDecl->getLocation(),
2385-
diag::note_constexpr_subobject_declared_here);
2382+
if (SubobjectDecl) {
2383+
Info.FFDiag(DiagLoc, diag::note_constexpr_uninitialized)
2384+
<< /*(name)*/ 1 << SubobjectDecl;
2385+
Info.Note(SubobjectDecl->getLocation(),
2386+
diag::note_constexpr_subobject_declared_here);
2387+
} else {
2388+
Info.FFDiag(DiagLoc, diag::note_constexpr_uninitialized)
2389+
<< /*of type*/ 0 << Type;
2390+
}
23862391
return false;
23872392
}
23882393

clang/lib/AST/Interp/Interp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD) {
382382
static void DiagnoseUninitializedSubobject(InterpState &S, const SourceInfo &SI,
383383
const FieldDecl *SubObjDecl) {
384384
assert(SubObjDecl && "Subobject declaration does not exist");
385-
S.FFDiag(SI, diag::note_constexpr_uninitialized) << SubObjDecl;
385+
S.FFDiag(SI, diag::note_constexpr_uninitialized)
386+
<< /*(name)*/ 1 << SubObjDecl;
386387
S.Note(SubObjDecl->getLocation(),
387388
diag::note_constexpr_subobject_declared_here);
388389
}

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
965965
AlignTokens(
966966
Style,
967967
[](Change const &C) {
968-
if (C.Tok->isOneOf(TT_FunctionDeclarationName, TT_FunctionTypeLParen))
968+
if (C.Tok->is(TT_FunctionDeclarationName))
969969
return true;
970970
if (C.Tok->isNot(TT_StartOfName))
971971
return false;

clang/lib/Parse/ParseDecl.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3998,8 +3998,15 @@ void Parser::ParseDeclarationSpecifiers(
39983998
case tok::kw_thread_local:
39993999
if (getLangOpts().C2x)
40004000
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
4001-
isInvalid = DS.SetStorageClassSpecThread(DeclSpec::TSCS_thread_local, Loc,
4002-
PrevSpec, DiagID);
4001+
// We map thread_local to _Thread_local in C23 mode so it retains the C
4002+
// semantics rather than getting the C++ semantics.
4003+
// FIXME: diagnostics will show _Thread_local when the user wrote
4004+
// thread_local in source in C23 mode; we need some general way to
4005+
// identify which way the user spelled the keyword in source.
4006+
isInvalid = DS.SetStorageClassSpecThread(
4007+
getLangOpts().C2x ? DeclSpec::TSCS__Thread_local
4008+
: DeclSpec::TSCS_thread_local,
4009+
Loc, PrevSpec, DiagID);
40034010
isStorageClass = true;
40044011
break;
40054012
case tok::kw__Thread_local:

0 commit comments

Comments
 (0)