[cfe-commits] PATCH: Remove llvm::InitializeAll* calls from SemaStmtAsm.cpp

Tom Stellard tom at stellard.net
Tue Oct 2 08:39:08 PDT 2012


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

-------------- next part --------------
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();

More information about the cfe-commits mailing list