[Lldb-commits] [PATCH] D63171: Don't try to parse ObjC method if CU isn't ObjC

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 11 17:33:43 PDT 2019

aprantl added a comment.

In D63171#1539070 <https://reviews.llvm.org/D63171#1539070>, @clayborg wrote:

> In D63171#1539049 <https://reviews.llvm.org/D63171#1539049>, @aprantl wrote:
> > I suppose one could compile Objective-C code on Linux using GCC.
> Will GCC not set the language to ObjC or ObjC++?

This was intended as a reply to:

> One question I have is all Darwin compilers currently support the apple DWARF indexes, so do we even need the objective C parsing code here?

Comment at: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:255
+          bool is_objc_method = false;
+          if (check_objc) {
+            ObjCLanguage::MethodName objc_method(name, true);
clayborg wrote:
> aprantl wrote:
> > Since check_objc is only used here, I think it would be better for readability to say 
> > ```
> > if (cu_language == eLanguageTypeObjC ||
> >     cu_language == eLanguageTypeObjC_plus_plus)
> > ```
> > here
> This is a hot loop. As long as the compiler will compute this once when optimizations are enabled, I am fine with inlining it into the if statement. But I pulled it out of the loop to ensure it only gets calculated once.
cu_language is a constant, so it should be safe for the compiler to hoist the computation. Also, this computation is so cheap that I'd rather optimize for readability.



More information about the lldb-commits mailing list