[cfe-commits] r173186 - in /cfe/trunk: include/clang/Basic/LangOptions.def include/clang/Driver/Options.td lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp lib/Parse/ParseStmt.cpp test/CodeGen/ms-inline-asm-64.c test/CodeGen/ms-inlin

Hi Chad,

So, I got to the bottom of it, and the problem is that Clang is looking for
a Target-Specific parser, while the target does not exist (since it wasn't
build for it).

599 // Get the target specific parser.
600 std::string Error;
601 const std::string &TT =
602 const llvm::Target *TheTarget(llvm::TargetRegistry::lookupTarget(TT,
604 OwningPtr<llvm::MCAsmInfo> MAI(TheTarget->createMCAsmInfo(TT));
605 OwningPtr<llvm::MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TT));
606 OwningPtr<llvm::MCObjectFileInfo> MOFI(new llvm::MCObjectFileInfo());
607 OwningPtr<llvm::MCSubtargetInfo>
608 STI(TheTarget->createMCSubtargetInfo(TT, "", ""));

on line 604 "TheTarget" is NULL.

So, there are two things here, and I'm including cfe-dev for discussion:

1. Any target-specific behaviour should be reported as an error early on
the compilation phase. Still, would be good to put an "user error" in here,
warning that the target was not compiled blah blah.

2. This test should be in a target-specific place, since even if the NULL
pointer is fixed, the test on non-i386 targets will still fail with a
"target not available" error message.


PS: You can reproduce by compiling on any machine but only building the ARM
backend (or possibly any non-i386 backends). This error is not specific to
MS ASM syntax, but was exposed by it.