================
@@ -2759,6 +2760,12 @@ MCSection 
*TargetLoweringObjectFileXCOFF::getSectionForLSDA(
 
//===----------------------------------------------------------------------===//
 TargetLoweringObjectFileGOFF::TargetLoweringObjectFileGOFF() = default;
 
+void TargetLoweringObjectFileGOFF::getModuleMetadata(Module &M) {
+  // Set the main file name if not set previously by the tool.
+  if (getContext().getMainFileName().empty())
+    getContext().setMainFileName(M.getSourceFileName());
----------------
uweigand wrote:

Hmm.  This sets the common-code "MainFileName", where it otherwise wouldn't be 
set.  I'm not sure if this is causing any problems - but it would be a place 
where we behave differently than others, which is usually better to avoid ...

If it makes sense in general to default MainFileName to SourceFileName when 
compiling a module, maybe that could and should be done in common code.

Otherwise, could we instead set the name to MainFileName (as default) in 
initGOFFMCObjectFileInfo, and then override to SourceFileName here (if empty)?  
 Probably need to hold the Root/Ada names as members of TLOF then.


https://github.com/llvm/llvm-project/pull/133799
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to