Skip to content

Commit e923a15

Browse files
authored
Merge pull request #3139 from Teemperor/cherry/5c676ba8323d
[lldb] Only warn about 'auto' types in the log instead of stderr
2 parents 1557a4b + a28676b commit e923a15

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

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/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)