Refactor SourceInfo into Source.

A Script object is associated with a Source object (HAS-A relation.)

A Source object describes the source code (more specifically, the LLVM
module) that is going to be compiled.

BCCContext contains the context used in a Source object.

BCCContext is now managed by the user not the libbcc itself. That is,
user should supply the context object when they create a Source object.

Change-Id: Icb8980d6f15cf30aa0415e69e3ae585d990dc156
diff --git a/lib/ExecutionEngine/BCCContext.cpp b/lib/ExecutionEngine/BCCContext.cpp
index 6d0c5b9..892fd5a 100644
--- a/lib/ExecutionEngine/BCCContext.cpp
+++ b/lib/ExecutionEngine/BCCContext.cpp
@@ -19,7 +19,9 @@
 #include <new>
 
 #include "BCCContextImpl.h"
+#include "Compiler.h"
 #include "DebugHelper.h"
+#include "Source.h"
 
 using namespace bcc;
 
@@ -40,7 +42,10 @@
   GlobalContext = NULL;
 }
 
-BCCContext::BCCContext() : mImpl(new BCCContextImpl(*this)) { }
+BCCContext::BCCContext() : mImpl(new BCCContextImpl(*this)) {
+  // Initialize the LLVM compiler infrastructure.
+  Compiler::GlobalInitialization();
+}
 
 BCCContext::~BCCContext() {
   delete mImpl;
@@ -49,9 +54,14 @@
     // Reset the GlobalContext.
     GlobalContext = NULL;
   }
-  return;
 }
 
+void BCCContext::addSource(Source &pSource)
+{ mImpl->mOwnSources.insert(&pSource); }
+
+void BCCContext::removeSource(Source &pSource)
+{ mImpl->mOwnSources.erase(&pSource); }
+
 llvm::LLVMContext &BCCContext::getLLVMContext()
 { return mImpl->mLLVMContext; }