Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,21 @@ static void SetupLangOpts(CompilerInstance &compiler,
lang_opts.CPlusPlus11 = true;
compiler.getHeaderSearchOpts().UseLibcxx = true;
[[fallthrough]];
case lldb::eLanguageTypeC_plus_plus_03:
case lldb::eLanguageTypeC_plus_plus_03: {
lang_opts.CPlusPlus = true;
if (process_sp
// We're stopped in a frame without debug-info. The user probably
// intends to make global queries (which should include Objective-C).
&& !(frame_sp && frame_sp->HasDebugInformation()))
&& !(frame_sp && frame_sp->HasDebugInformation())) {
lang_opts.ObjC =
process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr;
break;
if (lang_opts.ObjC) {
language_for_note = lldb::eLanguageTypeObjC_plus_plus;
language_fallback_reason = "Possibly stopped inside system library, so "
"speculatively enabled Objective-C. ";
}
}
} break;
case lldb::eLanguageTypeObjC_plus_plus:
case lldb::eLanguageTypeUnknown:
default:
Expand Down
19 changes: 19 additions & 0 deletions lldb/test/Shell/Expr/TestExprLanguageNote_NoDebug.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// REQUIRES: system-darwin
//
// Tests the language fall back diagnostic for when we fall back to
// Objective-C++ when stopped in frames with no debug-info.
//
// RUN: %clangxx_host %s -o %t.out
//
// RUN: %lldb %t.out \
// RUN: -o "b main" \
// RUN: -o run \
// RUN: -o "expr --language c++ -- blah" -o quit 2>&1 | FileCheck %s

// CHECK: (lldb) expr
// CHECK: note: Possibly stopped inside system library, so speculatively enabled Objective-C. Ran expression as 'Objective C++'.

int main() {
int x = 10;
return x;
}