[PATCH] D37715: Mark static member functions as static in CodeViewDebug

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 16:46:09 PDT 2017


rnk added a comment.

This should have an IRGen test. You can probably extend `clang/test/CodeGenCXX/debug-info-ms-abi.cpp` with a static method.



================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2907
     }
+
     // Check if it is a noreturn-marked function
----------------
Please revert the unrelated whitespace change


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3218
   }
+
   unsigned LineNo = getLineNumber(Loc);
----------------
ditto


================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:327-329
   TypeLoweringScope S(*this);
   TypeIndex TI =
       lowerTypeMemberFunction(SP->getType(), Class, SP->getThisAdjustment());
----------------
I suppose this is where we need to pass down a bool about this being a static member function.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1560-1564
   TypeIndex ThisTypeIndex = TypeIndex::Void();
   if (!ArgTypeIndices.empty()) {
     ThisTypeIndex = ArgTypeIndices.front();
     ArgTypeIndices = ArgTypeIndices.drop_front();
   }
----------------
If we had a bool `IsInstanceMethod` or something here we could skip this `drop_front()` dance and that would fix our parameters.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1625
 
-  // FIXME: Get Clang to mark DISubprogram as static and do something with it.
+  if (SP->getFlags() & DINode::FlagStaticMember)
+    return MethodKind::Static;
----------------
I'd do this check first, since static methods can't be virtual.


https://reviews.llvm.org/D37715





More information about the llvm-commits mailing list