Skip to content

Commit b6e6f45

Browse files
author
git apple-llvm automerger
committed
Merge commit 'a6e297d7a863' from apple/stable/20200714 into swift/release/5.4
2 parents 5197b7a + a6e297d commit b6e6f45

File tree

9 files changed

+79
-19
lines changed

9 files changed

+79
-19
lines changed

clang/include/clang/Basic/Builtins.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,12 @@ LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
885885
LANGBUILTIN(_rotl8, "UcUcUc", "n", ALL_MS_LANGUAGES)
886886
LANGBUILTIN(_rotl16, "UsUsUc", "n", ALL_MS_LANGUAGES)
887887
LANGBUILTIN(_rotl, "UiUii", "n", ALL_MS_LANGUAGES)
888-
LANGBUILTIN(_lrotl, "ULiULii", "n", ALL_MS_LANGUAGES)
888+
LANGBUILTIN(_lrotl, "UNiUNii", "n", ALL_MS_LANGUAGES)
889889
LANGBUILTIN(_rotl64, "UWiUWii", "n", ALL_MS_LANGUAGES)
890890
LANGBUILTIN(_rotr8, "UcUcUc", "n", ALL_MS_LANGUAGES)
891891
LANGBUILTIN(_rotr16, "UsUsUc", "n", ALL_MS_LANGUAGES)
892892
LANGBUILTIN(_rotr, "UiUii", "n", ALL_MS_LANGUAGES)
893-
LANGBUILTIN(_lrotr, "ULiULii", "n", ALL_MS_LANGUAGES)
893+
LANGBUILTIN(_lrotr, "UNiUNii", "n", ALL_MS_LANGUAGES)
894894
LANGBUILTIN(_rotr64, "UWiUWii", "n", ALL_MS_LANGUAGES)
895895
LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
896896
LANGBUILTIN(__fastfail, "vUi", "nr", ALL_MS_LANGUAGES)

clang/test/CodeGen/ms-intrinsics-rotations.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@
1212
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
1313
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
1414
// RUN: -triple x86_64--linux -emit-llvm %s -o - \
15-
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
15+
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
1616
// RUN: %clang_cc1 -ffreestanding -fms-extensions \
1717
// RUN: -triple x86_64--darwin -emit-llvm %s -o - \
18-
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
18+
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
19+
20+
// LP64 targets use 'long' as 'int' for MS intrinsics (-fms-extensions)
21+
#ifdef __LP64__
22+
#define LONG int
23+
#else
24+
#define LONG long
25+
#endif
1926

2027
// rotate left
2128

@@ -40,15 +47,12 @@ unsigned int test_rotl(unsigned int value, int shift) {
4047
// CHECK: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
4148
// CHECK: ret i32 [[R]]
4249

43-
unsigned long test_lrotl(unsigned long value, int shift) {
50+
unsigned LONG test_lrotl(unsigned LONG value, int shift) {
4451
return _lrotl(value, shift);
4552
}
4653
// CHECK-32BIT-LONG: i32 @test_lrotl
4754
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
4855
// CHECK-32BIT-LONG: ret i32 [[R]]
49-
// CHECK-64BIT-LONG: i64 @test_lrotl
50-
// CHECK-64BIT-LONG: [[R:%.*]] = call i64 @llvm.fshl.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
51-
// CHECK-64BIT-LONG: ret i64 [[R]]
5256

5357
unsigned __int64 test_rotl64(unsigned __int64 value, int shift) {
5458
return _rotl64(value, shift);
@@ -80,15 +84,12 @@ unsigned int test_rotr(unsigned int value, int shift) {
8084
// CHECK: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
8185
// CHECK: ret i32 [[R]]
8286

83-
unsigned long test_lrotr(unsigned long value, int shift) {
87+
unsigned LONG test_lrotr(unsigned LONG value, int shift) {
8488
return _lrotr(value, shift);
8589
}
8690
// CHECK-32BIT-LONG: i32 @test_lrotr
8791
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
8892
// CHECK-32BIT-LONG: ret i32 [[R]]
89-
// CHECK-64BIT-LONG: i64 @test_lrotr
90-
// CHECK-64BIT-LONG: [[R:%.*]] = call i64 @llvm.fshr.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
91-
// CHECK-64BIT-LONG: ret i64 [[R]]
9293

9394
unsigned __int64 test_rotr64(unsigned __int64 value, int shift) {
9495
return _rotr64(value, shift);

lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
7474
const CompilerType reserved_type =
7575
clang_ast_context->GetBasicType(lldb::eBasicTypeInt);
7676
const char *const FuncPtr_name("__FuncPtr");
77-
const CompilerType FuncPtr_type =
78-
clang_ast_importer->CopyType(*clang_ast_context, function_pointer_type);
7977

8078
m_block_struct_type = clang_ast_context->CreateStructForIdentifier(
8179
ConstString(), {{isa_name, isa_type},
8280
{flags_name, flags_type},
8381
{reserved_name, reserved_type},
84-
{FuncPtr_name, FuncPtr_type}});
82+
{FuncPtr_name, function_pointer_type}});
8583
}
8684

8785
~BlockPointerSyntheticFrontEnd() override = default;

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,20 @@ CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize(
11571157
// to fix any issues we run into.
11581158
if (!type_name.empty()) {
11591159
std::string type_name_str = type_name.str();
1160-
Host::SystemLog(Host::eSystemLogError,
1161-
"error: need to add support for DW_TAG_base_type '%s' "
1162-
"encoded with DW_ATE = 0x%x, bit_size = %u\n",
1163-
type_name_str.c_str(), dw_ate, bit_size);
1160+
// GCC and newer Clang versions emit 'auto' types. This isn't supported yet,
1161+
// but we should also not spam the stderr with warnings, so instead log
1162+
// these special types. See rdar://71352569
1163+
if (type_name_str == "auto") {
1164+
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
1165+
LLDB_LOGF(log, "error: need to add support for DW_TAG_base_type '%s' "
1166+
"encoded with DW_ATE = 0x%x, bit_size = %u\n",
1167+
type_name_str.c_str(), dw_ate, bit_size);
1168+
} else {
1169+
Host::SystemLog(Host::eSystemLogError,
1170+
"error: need to add support for DW_TAG_base_type '%s' "
1171+
"encoded with DW_ATE = 0x%x, bit_size = %u\n",
1172+
type_name_str.c_str(), dw_ate, bit_size);
1173+
}
11641174
} else {
11651175
Host::SystemLog(Host::eSystemLogError, "error: need to add support for "
11661176
"DW_TAG_base_type encoded with "

lldb/test/API/lang/c/blocks/TestBlocks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def setUp(self):
2020
# Find the line numbers to break at.
2121
self.lines.append(line_number('main.c', '// Set breakpoint 0 here.'))
2222
self.lines.append(line_number('main.c', '// Set breakpoint 1 here.'))
23+
self.lines.append(line_number('main.c', '// Set breakpoint 2 here.'))
2324

2425
def launch_common(self):
2526
self.build()
@@ -51,6 +52,10 @@ def test_expr(self):
5152
self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY,
5253
substrs=["= 12"])
5354

55+
self.wait_for_breakpoint()
56+
57+
self.expect_expr("h(cg)", result_type="int", result_value="42")
58+
5459
@skipUnlessDarwin
5560
def test_define(self):
5661
self.launch_common()

lldb/test/API/lang/c/blocks/main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include <stdio.h>
22

3+
struct CG {int x; int y;};
4+
5+
int g(int (^callback)(struct CG)) {
6+
struct CG cg = {.x=1,.y=2};
7+
8+
int z = callback(cg); // Set breakpoint 2 here.
9+
10+
return z;
11+
}
12+
13+
int h(struct CG cg){return 42;}
14+
315
int main()
416
{
517
int c = 1;
@@ -17,5 +29,12 @@ int main()
1729
printf("%d\n", add(3, 4));
1830
printf("%d\n", neg(-5)); // Set breakpoint 1 here.
1931

32+
int (^add_struct)(struct CG) = ^int(struct CG cg)
33+
{
34+
return cg.x + cg.y;
35+
};
36+
37+
g(add_struct);
38+
2039
return 0;
2140
}

lldb/test/Shell/Expr/Inputs/auto.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
struct Foo {
2+
auto i();
3+
};
4+
5+
auto Foo::i() {
6+
return 1;
7+
}
8+
9+
int main() {
10+
Foo f;
11+
f.i();
12+
}

lldb/test/Shell/Expr/TestAutoErr.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# RUN: %clangxx_host %p/Inputs/auto.cpp -std=c++14 -g -o %t
2+
3+
# Test for emitted 'auto' types: rdar://71352569
4+
5+
# The warning shouldn't appear in the stderr output.
6+
# RUN: %lldb -o "expr Foo f" %t -b 2>&1 | FileCheck --check-prefix=NO_OUT %s
7+
# But the warning should be in the log.
8+
# We add the log enable command here as an argument as the channel names
9+
# matches the word 'LLDB' and our sanity check substitution will kick in and
10+
# warn us about using the word 'LLDB' instead of '%lldb" in a run invocation.
11+
# RUN: %lldb -s %p/enable_log -o "expr Foo f" %t -b | FileCheck %s
12+
13+
# CHECK: error: need to add support for DW_TAG_base_type 'auto'
14+
# NO_OUT-NOT: error: need to add support for DW_TAG_base_type 'auto'

lldb/test/Shell/Expr/enable_log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
log enable lldb types

0 commit comments

Comments
 (0)