dawn added a comment. PS: I hope you won't return ObjC++ if language is unknown for any of the code you write - see inline comment.
PPS: Many thanks again for all your reviews!! ================ Comment at: source/Target/Target.cpp:2158-2178 @@ -2136,1 +2157,23 @@ +// Return the language of the selected frame's CU. +lldb::LanguageType +Target::GetLanguageOfSelectedFrame () const +{ + LanguageType language = eLanguageTypeUnknown; + if (m_process_sp) + { + ThreadSP sel_thread_sp(m_process_sp->GetThreadList().GetSelectedThread()); + if (sel_thread_sp) + { + StackFrameSP sel_frame_sp = sel_thread_sp->GetSelectedFrame(); + if (sel_frame_sp) + { + CompileUnit *cu = sel_frame_sp->GetSymbolContext(eSymbolContextCompUnit).comp_unit; + if (cu) + language = cu->GetLanguage(); + } + } + } + return language; +} + ---------------- clayborg wrote: > This should be moved to the StackFrame as: > > ``` > lldb::LanguageType > StackFrame::GetDefaultExpressionLanguage(); > ``` > > And it should check if the language is form of C, C++, ObjC, or ObjC ++, then > return ObjC++, else return the language. ObjC++ should not be the default, because then the code/user can't know if it really is unknown or is in a ObjC++ context. Having it return unknown is good - the expression code sets the compiler's language options for unknown the same as ObjC++ anyway (see code in ClangExpressionParser::ClangExpressionParser). Repository: rL LLVM http://reviews.llvm.org/D11482 _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits