Apply changes to migrate to LLVM upstream Oct 20th 2011.

- StructType::isAnonymous is renamed to StructType::isLiteral.

- PassManagerBuilder has been moved from
  llvm/Support/PassManagerBuilder.h to
  llvm/Transforms/IPO/PassManagerBuilder.h

- Include llvm/Transforms/IPO.h for llvm::createInternalizePass.

- clang::DiagClient has be renamed to clang::DiagnosticConsumer.
  Besides, we have to implement one additional pure virtual method
  'clone' for create a clone of slang::DiagnosticBuffer.

- llvm::Linker::LinkModules comes with one additional parameter.
  Passing llvm::Linker::DestroySource should be equivalent to
  the old code we were using.

- slang::Slang is now derived from clang::ModuleLoader and implemented
  loadModule pure virtual method (though we will always return NULL.)

- clang::Preprocessor is taking one additional parameter for
  clang::ModuleLoader.

- clang::Diagnostic has been changed.  A lot of the method has been
  moved to clang::DiagnosticsEngine, and we can no longer 'Report' a
  diagnostic from clang::Diagnostic.  We have to use
  clang::DiagnosticEngine instead.

- llvm::setCodeModel has been removed.

Change-Id: I1f2a4cbeaf61a8ed1d0d635a5a0e1baa90d99d07
diff --git a/slang_diagnostic_buffer.h b/slang_diagnostic_buffer.h
index 3c4e1c7..e4eeaab 100644
--- a/slang_diagnostic_buffer.h
+++ b/slang_diagnostic_buffer.h
@@ -29,17 +29,24 @@
 
 namespace slang {
 
-// The diagnostics client instance (for reading the processed diagnostics)
-class DiagnosticBuffer : public clang::DiagnosticClient {
+// The diagnostics consumer instance (for reading the processed diagnostics)
+class DiagnosticBuffer : public clang::DiagnosticConsumer {
  private:
   std::string mDiags;
-  llvm::raw_string_ostream *mSOS;
+  llvm::OwningPtr<llvm::raw_string_ostream> mSOS;
 
  public:
   DiagnosticBuffer();
 
-  virtual void HandleDiagnostic(clang::Diagnostic::Level DiagLevel,
-                                const clang::DiagnosticInfo& Info);
+  DiagnosticBuffer(DiagnosticBuffer const &src);
+
+  virtual ~DiagnosticBuffer();
+
+  virtual void HandleDiagnostic(clang::DiagnosticsEngine::Level DiagLevel,
+                                const clang::Diagnostic& Info);
+
+  virtual clang::DiagnosticConsumer *
+    clone(clang::DiagnosticsEngine &Diags) const;
 
   inline const std::string &str() const {
     mSOS->flush();
@@ -48,11 +55,9 @@
 
   inline void reset() {
     this->mSOS->str().clear();
-    return;
   }
-
-  virtual ~DiagnosticBuffer();
 };
+
 }
 
 #endif  // _FRAMEWORKS_COMPILE_SLANG_SLANG_DIAGNOSTIC_BUFFER_H_  NOLINT