-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Assure DIFiles get the directory name during IRCodeGen #22624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
|
||
if (!CWDName.empty()) | ||
return CWDName; | ||
SmallString<256> CWD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A newline before this line would be nice.
PDB generation assumes DIFiles have both a filename and a directory. IRGenDebugInfoImpl currently checks if an absolute path is given for the Filename and if not it just moves forward with only the filename which causes PDB generation to be broken. Clang handles a non absolute path for a file by by first querying the DebugCompilationDir then the IGM.CWDName and lastly just getting llvm::sys::fs::current_path. We should do the same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the right place to call current_path. Instead, we should make sure that the frontend or driver is setting IGM.getOptions().DebugCompilationDir correctly.
Is that feasible? |
@adrian-prantl, hmm... the frontend already does that if you are asking for more than line tables.
|
Build failed |
Okay, so that is the DI for the synthetic |
@swift-ci please test |
Build failed |
Build failed |
@compnerd I'm confused. If the frontend is always setting Opts.DebugCompilationDir, why do we need to query llvm::sys::fs again here? |
@adrian-prantl the frontend is setting it for the user requested compilation. This is the synthetic (compiler generated) [in memory] buffer that has the compiler provided |
In lib/FrontEnd/CompilerInvocation.cpp we have
so this seems to still be necessary regardless. |
Oh, is the problem that the I still have this unmerged patch over in #22392 which brings Swift closer to Clang and it specifically handles these placeholder files differently. That patch makes every file path absolute except for |
Basically all you should need to do is add special handling for the PDB case here
and substitute Opts.DebugCompilationDir |
Not sure that I like the way that we identify the synthetic file, but sounds like your suggestion should do the trick. |
Agreed. A |
Solved via adrian-prantl's patch. |
PDB generation assumes DIFiles have both a filename and a directory.
IRGenDebugInfoImpl currently checks if an absolute path is given for
the Filename and if not it just moves forward with only the filename
which causes PDB generation to be broken.
Clang handles a non absolute path for a file by by first querying the
DebugCompilationDir then the IGM.CWDName and lastly just getting
llvm::sys::fs::current_path. We should do the same here.