[PATCH] D139864: [AIX] Demangle the name prefix with '.' in AIX OS for llvm-cxxfilt

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 07:28:26 PST 2023


DiggerLin marked 3 inline comments as done.
DiggerLin added inline comments.


================
Comment at: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp:72
+  // In XCOFF, Function entry lable begin with '.'.
+  if (Triple(sys::getProcessTriple()).isOSBinFormatXCOFF() && DecoratedStr[0] == '.') {
+    ++DecoratedStr;
----------------
stephenpeckham wrote:
> Wouldn't it make more sense to introduce a StripDot variable similar to StripUnderscore?
we do not do  StripDot, we just demangle the symbol begin with "dot" if there is. (and this is xcoff specific option)  I checked AIX clangtana cxxfilt, it do not has an option for "demangling the symbol begin with 'dot') . So I think we also do not need an option here and  not need to introduce a new variable "StripDot".



================
Comment at: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp:84
+    return DotPrefix + Result;
 
   std::string Prefix;
----------------
stephenpeckham wrote:
> I'm not sure I understand the interaction of all the options and demangling methods, but if nonMicrosoftDemangle() returns false, maybe the potential leading dot should be restored for the rest of this function.

if (nonMicrosoftDemangle(DecoratedStr, Result)) return false.
it will continue the following code till 

```
 Result = Undecorated ? DotPrefix + Prefix + Undecorated : Mangled;
  free(Undecorated);
```

not sure whether I answer your comment or not? 


================
Comment at: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp:180
     StripUnderscore = Triple(sys::getProcessTriple()).isOSBinFormatMachO();
 
   Types = Args.hasArg(OPT_types);
----------------
stephenpeckham wrote:
> Set StripDot here if appropriate
1.  for '_' , there is an  option  "--strip-underscore" , and the ""--strip-underscore"(and the option also work for other triple) is set d enabled by default for MachO.

2.  if we want to introduce a new option "--decode-dot", Setting here is  reasonable, but it do not think we need to introduce a new option "--decode-dot" , (AIX clangtana cxxfilt do not have any option),  and  other triple do not has the feature.    


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139864/new/

https://reviews.llvm.org/D139864



More information about the llvm-commits mailing list