[cfe-dev] TextDiagnosticPrinter::HandleDiagnostic() question

Douglas Gregor dgregor at apple.com
Fri Apr 22 13:09:00 PDT 2011


On Apr 22, 2011, at 11:45 AM, Andrew Fish wrote:

> When using the x86_64-pc-win32-macho triple we end up compiling and debugging on OS X and building a Win32 API (for us really an EFI API) image.
> 
> The following code in TextDiagnosticPrinter::HandleDiagnostic()  causes diagnostic messages that don't work with Xcode
> 
>        // Emit a Visual Studio compatible line number syntax.
>        if (LangOpts && LangOpts->Microsoft) {
>          OS << PLoc.getFilename() << '(' << LineNo << ')';
>          OS << " : ";
>        } else {
>          OS << PLoc.getFilename() << ':' << LineNo << ':';
>          if (DiagOpts->ShowColumn)
>            if (unsigned ColNo = PLoc.getColumn())
>              OS << ColNo << ':';
>        }
> 
> On the backend side I know that we use things like Triple.getEnvironment() != llvm::Triple::MachO. I'm not sure what we do on the front end. 
> 
> Seems to me that LangOpts->Microsoft implies code construction and not OS version that the system is running on? 
> 
> So how could we make normal clang diagnostics appear for for the 86_64-pc-win32-macho triple?


The right approach would be to add an option bit to DiagnosticOptions that tells the diagnostic printers to print in a cl.exe-compatible syntax, along with clang driver options to set that diagnostic bit. 

	- Doug



More information about the cfe-dev mailing list