assembler-with-cpp and debug info

If we have a hand-coded assembler source file, and use Clang to process
it through the preprocessor, the preprocessor leaves behind directives
of the form
  # line-number "filename"
indicating the original source information of the preprocessed file.
That's all good.

If we use Clang to both preprocess and assemble the file with the integrated
assembler (i.e., -x assembler-with-cpp), and use -g to get debug info, then
it turns out the final object file's debug info will refer to the temp file
that the Clang preprocessor created, not the original source file. It's
ignoring the #line-number directives. That's not so good.

If I use "-no-integrated-as -Wa,-g" instead of just "-g", then the debug info
comes out the way I want it to, i.e. inferring .debug_line information from
the #line-number directives. So, this would be a "gas" compatibility issue.

Is there a way to get the integrated assembler to use the #line-number
directives for debug info? Or is this just not implemented yet?

Not yet implemented. If you're interested, the relevant code for the
locations is getStreamer().EmitDwarfLocDirective in
AsmParser::ParseStatement in llvm/lib/MC/MCParser/AsmParser.cpp , and
the relevant code for '#' parsing is
AsmParser::ParseCppHashLineFilenameComment in the same file.


Okay, I'll pass my workaround along to my client and see if I can
get the work scheduled. Appreciate the pointers, thanks!