Hi,

I noticed that the llvm:InitializeAll* functions are called from the
middle of the Sema::ActOnMSAsmStmt() function in Sema/SemaStmtAsm.cpp.
Is this necessary?  Shouldn't the program that uses libclang be
responsible for initializing the appropriate targets?

Additionally, calling these functions require that any program linked with
libclangSema also link against all the LLVM built targets.

I've attached a patch removing these function calls.  Any thoughts on
this?

Thanks,
Tom
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp
index af59e34..81ae7e7 100644
--- a/lib/Sema/SemaStmtAsm.cpp
+++ b/lib/Sema/SemaStmtAsm.cpp
@@ -522,11 +522,6 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, 
SourceLocation LBraceLoc,
   // AsmParser doesn't fully support these asm statements.
   if (bailOnMSAsm(Pieces)) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); }
 
-  // Initialize targets and assembly printers/parsers.
-  llvm::InitializeAllTargetInfos();
-  llvm::InitializeAllTargetMCs();
-  llvm::InitializeAllAsmParsers();
-
   // Get the target specific parser.
   std::string Error;
   const std::string &TT = Context.getTargetInfo().getTriple().getTriple();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to