Skip to content

Commit 586d33c

Browse files
committed
merge main into amd-staging
2 parents 575ccad + 00bdce1 commit 586d33c

File tree

24 files changed

+327
-74
lines changed

24 files changed

+327
-74
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4991,8 +4991,8 @@ bool Compiler<Emitter>::visitCompoundStmt(const CompoundStmt *S) {
49914991
template <class Emitter>
49924992
bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
49934993
for (const auto *D : DS->decls()) {
4994-
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, UsingEnumDecl,
4995-
FunctionDecl>(D))
4994+
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, BaseUsingDecl,
4995+
FunctionDecl, NamespaceAliasDecl>(D))
49964996
continue;
49974997

49984998
const auto *VD = dyn_cast<VarDecl>(D);

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4106,7 +4106,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
41064106
if (AngleNestingLevel == 0) {
41074107
if (FormatTok->is(tok::colon)) {
41084108
IsDerived = true;
4109-
} else if (FormatTok->is(tok::identifier) &&
4109+
} else if (!IsDerived && FormatTok->is(tok::identifier) &&
41104110
FormatTok->Previous->is(tok::coloncolon)) {
41114111
ClassName = FormatTok;
41124112
} else if (FormatTok->is(tok::l_paren) &&

clang/test/AST/ByteCode/literals.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,18 @@ namespace TypeTraits {
914914
}
915915

916916
#if __cplusplus >= 201402L
917+
namespace SomeNS {
918+
using MyInt = int;
919+
}
920+
917921
constexpr int ignoredDecls() {
918922
static_assert(true, "");
919923
struct F { int a; };
920924
enum E { b };
921925
using A = int;
922926
typedef int Z;
927+
namespace NewNS = SomeNS;
928+
using NewNS::MyInt;
923929

924930
return F{12}.a;
925931
}

clang/test/CodeGen/blocks-windows.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@
22
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
33
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
44
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
5-
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
6-
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
5+
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
6+
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
77

88
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DECL -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DECL
99
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
1010
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
1111
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
12-
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
13-
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
12+
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
13+
// RUN: %clang_cc1 -triple thumbv7-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
1414

1515
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DECL -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DECL
1616
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
1717
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
1818
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
19-
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
20-
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
19+
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
20+
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
2121

2222
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DECL -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DECL
2323
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
2424
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
2525
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
26-
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
27-
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
26+
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
27+
// RUN: %clang_cc1 -triple i686-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
2828

2929
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DECL -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DECL
3030
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
3131
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
3232
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
33-
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
34-
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
33+
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
34+
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
3535

3636
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DECL -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DECL
3737
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_IN_BLOCKS_DEFN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-IN-BLOCKS-DEFN
3838
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS
3939
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN
40-
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
41-
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLCOKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
40+
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_EXTERN_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-EXTERN-DLLIMPORT
41+
// RUN: %clang_cc1 -triple x86_64-windows -fblocks -fdeclspec -DBLOCKS_NOT_IN_BLOCKS_DLLIMPORT -Os -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-BLOCKS-NOT-IN-BLOCKS-DLLIMPORT
4242

4343
void *_Block_copy(void *);
4444

clang/unittests/Format/TokenAnnotatorTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3406,6 +3406,13 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
34063406
EXPECT_BRACE_KIND(Tokens[7], BK_Block);
34073407
EXPECT_BRACE_KIND(Tokens[8], BK_Block);
34083408

3409+
Tokens = annotate("struct Foo<int> : Base::Bar {};");
3410+
ASSERT_EQ(Tokens.size(), 13u) << Tokens;
3411+
EXPECT_TOKEN(Tokens[1], tok::identifier, TT_ClassHeadName);
3412+
EXPECT_TOKEN(Tokens[8], tok::identifier, TT_Unknown); // Not TT_ClassHeadName.
3413+
EXPECT_BRACE_KIND(Tokens[9], BK_Block);
3414+
EXPECT_BRACE_KIND(Tokens[10], BK_Block);
3415+
34093416
Tokens = annotate("struct Foo final {};");
34103417
ASSERT_EQ(Tokens.size(), 7u) << Tokens;
34113418
EXPECT_TOKEN(Tokens[1], tok::identifier, TT_ClassHeadName);

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ function(_get_common_compile_options output_var flags)
179179
endif()
180180
list(APPEND compile_options "-Wconversion")
181181
list(APPEND compile_options "-Wno-sign-conversion")
182-
# Silence this warning because _Complex is a part of C99.
182+
list(APPEND compile_options "-Wdeprecated")
183183
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
184+
# Silence this warning because _Complex is a part of C99.
184185
list(APPEND compile_options "-fext-numeric-literals")
185186
else()
186187
list(APPEND compile_options "-Wno-c99-extensions")

libc/src/__support/CPP/span.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <stddef.h> // For size_t
1212

13-
#include "array.h" // For array
13+
#include "array.h" // For array
1414
#include "src/__support/macros/config.h"
1515
#include "type_traits.h" // For remove_cv_t, enable_if_t, is_same_v, is_const_v
1616

@@ -52,6 +52,8 @@ template <typename T> class span {
5252

5353
LIBC_INLINE constexpr span() : span_data(nullptr), span_size(0) {}
5454

55+
LIBC_INLINE constexpr span(const span &) = default;
56+
5557
LIBC_INLINE constexpr span(pointer first, size_type count)
5658
: span_data(first), span_size(count) {}
5759

libc/test/src/setjmp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ add_libc_unittest(
1111
libc_setjmp_unittests
1212
SRCS
1313
setjmp_test.cpp
14+
CXX_STANDARD
15+
20
1416
DEPENDS
1517
libc.src.setjmp.longjmp
1618
libc.src.setjmp.setjmp

libc/test/src/setjmp/setjmp_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TEST(LlvmLibcSetJmpTest, SetAndJumpBack) {
2727
// The first time setjmp is called, it should return 0.
2828
// Subsequent calls will return the value passed to jump_back below.
2929
if (LIBC_NAMESPACE::setjmp(buf) <= MAX_LOOP) {
30-
++n;
30+
n = n + 1;
3131
jump_back(buf, n);
3232
}
3333
ASSERT_EQ(longjmp_called, n);

lld/ELF/ScriptLexer.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void ScriptLexer::lex() {
105105
curBuf = buffers.pop_back_val();
106106
continue;
107107
}
108-
curTokState = inExpr;
108+
curTokState = lexState;
109109

110110
// Quoted token. Note that double-quote characters are parts of a token
111111
// because, in a glob match context, only unquoted tokens are interpreted
@@ -142,18 +142,21 @@ void ScriptLexer::lex() {
142142
// C-like languages, so that you can write "file-name.cpp" as one bare
143143
// token.
144144
size_t pos;
145-
if (inExpr) {
145+
switch (lexState) {
146+
case State::Script:
147+
pos = s.find_first_not_of(
148+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
149+
"0123456789_.$/\\~=+[]*?-!^:");
150+
break;
151+
case State::Expr:
146152
pos = s.find_first_not_of(
147153
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
148154
"0123456789_.$");
149155
if (pos == 0 && s.size() >= 2 &&
150156
((s[0] == s[1] && strchr("<>&|", s[0])) ||
151157
is_contained({"==", "!=", "<=", ">=", "<<", ">>"}, s.substr(0, 2))))
152158
pos = 2;
153-
} else {
154-
pos = s.find_first_not_of(
155-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
156-
"0123456789_.$/\\~=+[]*?-!^:");
159+
break;
157160
}
158161

159162
if (pos == 0)
@@ -208,8 +211,8 @@ StringRef ScriptLexer::next() {
208211
}
209212

210213
StringRef ScriptLexer::peek() {
211-
// curTok is invalid if curTokState and inExpr mismatch.
212-
if (curTok.size() && curTokState != inExpr) {
214+
// curTok is invalid if curTokState and lexState mismatch.
215+
if (curTok.size() && curTokState != lexState) {
213216
curBuf.s = StringRef(curTok.data(), curBuf.s.end() - curTok.data());
214217
curTok = {};
215218
}

0 commit comments

Comments
 (0)