diff --git a/interpreter/cling/LastKnownGoodLLVMSVNRevision.txt b/interpreter/cling/LastKnownGoodLLVMSVNRevision.txt
index 63cbe548c1c8ad1ccda03ca6631fabff122663bf..612afc97d2629ac4f91ffe0169ba9825ed08dede 100644
--- a/interpreter/cling/LastKnownGoodLLVMSVNRevision.txt
+++ b/interpreter/cling/LastKnownGoodLLVMSVNRevision.txt
@@ -1 +1 @@
-274612
+302975
diff --git a/interpreter/cling/include/cling/Interpreter/ClingCodeCompleteConsumer.h b/interpreter/cling/include/cling/Interpreter/ClingCodeCompleteConsumer.h
index e85596d1f0ac7e0f1155656a910056107a93b8ae..2d0a416bac7683a56059c7c3d2542430fa4d0cd7 100644
--- a/interpreter/cling/include/cling/Interpreter/ClingCodeCompleteConsumer.h
+++ b/interpreter/cling/include/cling/Interpreter/ClingCodeCompleteConsumer.h
@@ -26,7 +26,7 @@ namespace cling {
     ClingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
                               std::vector<std::string> &completions)
       : CodeCompleteConsumer(CodeCompleteOpts, false),
-        m_CCTUInfo(new GlobalCodeCompletionAllocator),
+        m_CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()),
         m_Completions(completions) {}
     ~ClingCodeCompleteConsumer() {}
 
diff --git a/interpreter/cling/include/cling/Interpreter/Exception.h b/interpreter/cling/include/cling/Interpreter/Exception.h
index 0f36069b01f3a6b96e7112e9cce47b46dd7d4b34..7a3a46d151e5f704ec18d1f457ffb480ff03bb1b 100644
--- a/interpreter/cling/include/cling/Interpreter/Exception.h
+++ b/interpreter/cling/include/cling/Interpreter/Exception.h
@@ -28,7 +28,7 @@ namespace cling {
   public:
     InterpreterException(const std::string& Reason);
     InterpreterException(const char* What, clang::Sema* = nullptr);
-    virtual ~InterpreterException() LLVM_NOEXCEPT;
+    virtual ~InterpreterException() noexcept;
 
     ///\brief Return true if error was diagnosed false otherwise
     virtual bool diagnose() const;
@@ -45,7 +45,7 @@ namespace cling {
     const DerefType m_Type;
   public:
     InvalidDerefException(clang::Sema* S, const clang::Expr* E, DerefType type);
-    virtual ~InvalidDerefException() LLVM_NOEXCEPT;
+    virtual ~InvalidDerefException() noexcept;
 
     bool diagnose() const override;
   };
@@ -60,7 +60,7 @@ namespace cling {
   class CompilationException: public InterpreterException {
   public:
     CompilationException(const std::string& Reason);
-    ~CompilationException() LLVM_NOEXCEPT;
+    ~CompilationException() noexcept;
 
     // Handle fatal llvm errors by throwing an exception.
     // Yes, throwing exceptions in error handlers is bad.
diff --git a/interpreter/cling/lib/Interpreter/AutoloadCallback.cpp b/interpreter/cling/lib/Interpreter/AutoloadCallback.cpp
index 303c233bcf605bff5efcc5681d8d70019b3dbfb6..1dd2f8c9b59e9c244bf06a9ec4d368522bd66f35 100644
--- a/interpreter/cling/lib/Interpreter/AutoloadCallback.cpp
+++ b/interpreter/cling/lib/Interpreter/AutoloadCallback.cpp
@@ -124,8 +124,8 @@ namespace cling {
           FE = m_PP->LookupFile(fileNameLoc, FileName, isAngled,
                                 FromDir, FromFile, CurDir, /*SearchPath*/0,
                                 /*RelativePath*/ 0, /*suggestedModule*/0,
-                                /*SkipCache*/ false, /*OpenFile*/ false,
-                                /*CacheFail*/ true);
+                                /*IsMapped*/0, /*SkipCache*/ false,
+                                /*OpenFile*/ false, /*CacheFail*/ true);
           needCacheUpdate = true;
         }
 
diff --git a/interpreter/cling/lib/Interpreter/BackendPasses.cpp b/interpreter/cling/lib/Interpreter/BackendPasses.cpp
index f0b72e66efd4dbbd87d3270c1f95ae369decc1d5..a885936704ea24ce17f781a4ae31bdf1377e4d18 100644
--- a/interpreter/cling/lib/Interpreter/BackendPasses.cpp
+++ b/interpreter/cling/lib/Interpreter/BackendPasses.cpp
@@ -17,7 +17,8 @@
 #include "llvm/IR/Verifier.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/IPO/InlinerPass.h"
+#include "llvm/Transforms/IPO/AlwaysInliner.h"
+#include "llvm/Transforms/IPO/Inliner.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 #include "llvm/Transforms/Scalar.h"
 
@@ -106,7 +107,7 @@ void BackendPasses::CreatePasses(llvm::Module& M, int OptLevel)
 
   // Handle disabling of LLVM optimization, where we want to preserve the
   // internal module before any optimization.
-  if (m_CGOpts.DisableLLVMOpts) {
+  if (m_CGOpts.DisableLLVMPasses) {
     OptLevel = 0;
     // Always keep at least ForceInline - NoInlining is deadly for libc++.
     // Inlining = CGOpts.NoInlining;
@@ -120,33 +121,21 @@ void BackendPasses::CreatePasses(llvm::Module& M, int OptLevel)
   PMBuilder.LoopVectorize = OptLevel > 1 ? 1 : 0; // m_CGOpts.VectorizeLoop
 
   PMBuilder.DisableTailCalls = m_CGOpts.DisableTailCalls;
-  PMBuilder.DisableUnitAtATime = OptLevel == 2 ? !m_CGOpts.UnitAtATime : 1;
   PMBuilder.DisableUnrollLoops = !m_CGOpts.UnrollLoops;
   PMBuilder.MergeFunctions = m_CGOpts.MergeFunctions;
   PMBuilder.RerollLoops = m_CGOpts.RerollLoops;
 
   PMBuilder.LibraryInfo = new TargetLibraryInfoImpl(m_TM.getTargetTriple());
 
-
-  switch (Inlining) {
-  case CodeGenOptions::OnlyHintInlining: // fall-through:
-    case CodeGenOptions::NoInlining: {
-      assert(0 && "libc++ requires at least OnlyAlwaysInlining!");
-      break;
-    }
-    case CodeGenOptions::NormalInlining: {
-      PMBuilder.Inliner =
-        createFunctionInliningPass(OptLevel, m_CGOpts.OptimizeSize);
-      break;
-    }
-    case CodeGenOptions::OnlyAlwaysInlining:
-      // Respect always_inline.
-      if (OptLevel == 0)
-        // Do not insert lifetime intrinsics at -O0.
-        PMBuilder.Inliner = createAlwaysInlinerPass(false);
-      else
-        PMBuilder.Inliner = createAlwaysInlinerPass();
-      break;
+  // At O0 and O1 we only run the always inliner which is more efficient. At
+  // higher optimization levels we run the normal inliner.
+  if (m_CGOpts.OptimizationLevel <= 1) {
+    bool InsertLifetimeIntrinsics = m_CGOpts.OptimizationLevel != 0;
+    PMBuilder.Inliner = createAlwaysInlinerLegacyPass(InsertLifetimeIntrinsics);
+  } else {
+    PMBuilder.Inliner = createFunctionInliningPass(m_CGOpts.OptimizationLevel,
+                                                   m_CGOpts.OptimizeSize,
+            (!m_CGOpts.SampleProfileFile.empty() && m_CGOpts.EmitSummaryIndex));
   }
 
   // Set up the per-module pass manager.
@@ -156,13 +145,7 @@ void BackendPasses::CreatePasses(llvm::Module& M, int OptLevel)
   m_MPM[OptLevel]->add(createTargetTransformInfoWrapperPass(
                                                    m_TM.getTargetIRAnalysis()));
 
-  // Add target-specific passes that need to run as early as possible.
-  PMBuilder.addExtension(
-                         PassManagerBuilder::EP_EarlyAsPossible,
-                         [&](const PassManagerBuilder &,
-                             legacy::PassManagerBase &PM) {
-                           m_TM.addEarlyAsPossiblePasses(PM);
-                         });
+  m_TM.adjustPassManager(PMBuilder);
 
   PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
                          [&](const PassManagerBuilder &,
diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp
index 5834b5a3e722bab46b64ac3f0aca4071c920fa60..f8f30acd6167c4f8f8f3f1a1ff7e905438e6710f 100644
--- a/interpreter/cling/lib/Interpreter/CIFactory.cpp
+++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp
@@ -29,6 +29,7 @@
 #include "clang/Frontend/VerifyDiagnosticConsumer.h"
 #include "clang/Serialization/SerializationDiagnostic.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaDiagnostic.h"
 #include "clang/Serialization/ASTReader.h"
@@ -39,6 +40,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetOptions.h"
@@ -730,8 +732,7 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
       argvCompile.push_back("-");
     }
 
-    std::unique_ptr<clang::CompilerInvocation>
-      InvocationPtr(new clang::CompilerInvocation);
+    auto InvocationPtr = std::make_shared<clang::CompilerInvocation>();
 
     // The compiler invocation is the owner of the diagnostic options.
     // Everything else points to them.
@@ -775,8 +776,7 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
 
     // Create and setup a compiler instance.
     std::unique_ptr<CompilerInstance> CI(new CompilerInstance());
-    CI->setInvocation(InvocationPtr.get());
-    InvocationPtr.release();
+    CI->setInvocation(InvocationPtr);
     CI->setDiagnostics(Diags.get()); // Diags is ref-counted
     if (!OnlyLex)
       CI->getDiagnosticOpts().ShowColors = cling::utils::ColorizeOutput();
@@ -850,7 +850,8 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
                                                CI->getFileManager(),
                                                CI->getPCHContainerReader(),
                                                false /*FindModuleFileExt*/,
-                                               listener)) {
+                                               listener,
+                                         /*ValidateDiagnosticOptions=*/false)) {
           // When running interactively pass on the info that the PCH
           // has failed so that IncrmentalParser::Initialize won't try again.
           if (!HasInput && llvm::sys::Process::StandardInIsUserInput()) {
diff --git a/interpreter/cling/lib/Interpreter/DeclUnloader.h b/interpreter/cling/lib/Interpreter/DeclUnloader.h
index 0ae71cedec49bea36f7b72c0e02efbdcc67e22be..2ac0368fc0e2959a5d70120402f81603ee88676c 100644
--- a/interpreter/cling/lib/Interpreter/DeclUnloader.h
+++ b/interpreter/cling/lib/Interpreter/DeclUnloader.h
@@ -264,7 +264,7 @@ namespace cling {
     ///
     void CollectFilesToUncache(clang::SourceLocation Loc);
 
-    LLVM_CONSTEXPR static bool isDefinition(void*) { return false; }
+    constexpr static bool isDefinition(void*) { return false; }
     static bool isDefinition(clang::TagDecl* R);
 
     static void resetDefinitionData(void*) {
diff --git a/interpreter/cling/lib/Interpreter/DynamicLookup.cpp b/interpreter/cling/lib/Interpreter/DynamicLookup.cpp
index 82eb9d4d77495e0cc9f4ccf7ec4298cbd908c198..a8175847f8602f3d7077977366fef8c340db3102 100644
--- a/interpreter/cling/lib/Interpreter/DynamicLookup.cpp
+++ b/interpreter/cling/lib/Interpreter/DynamicLookup.cpp
@@ -96,9 +96,8 @@ namespace {
 
           if (Node->hasExplicitTemplateArgs())
             TemplateSpecializationType::PrintTemplateArgumentList(OS,
-                                                        Node->getTemplateArgs(),
-                                                     Node->getNumTemplateArgs(),
-                                                                      m_Policy);
+                                                     Node->template_arguments(),
+                                                                  m_Policy);
           if (Node->hasExplicitTemplateArgs())
             assert((Node->getTemplateArgs() || Node->getNumTemplateArgs()) && \
                    "There shouldn't be template paramlist");
@@ -490,8 +489,7 @@ namespace cling {
                                        Inits);
         m_Sema->AddInitializerToDecl(HandlerInstance,
                                      InitExprResult.get(),
-                                     /*DirectInit*/ true,
-                                     /*TypeMayContainAuto*/ false);
+                                     /*DirectInit*/ true);
 
         // 2.5 Register the instance in the enclosing context
         CuredDecl->getDeclContext()->addDecl(HandlerInstance);
@@ -783,8 +781,7 @@ namespace cling {
                                        //valid!
                                        // TODO: Propose a patch in clang
                                        m_NoRange,
-                                       Initializer.get(),
-                                       /*TypeMayContainAuto*/false
+                                       Initializer.get()
                                        ).get();
     return Result;
   }
diff --git a/interpreter/cling/lib/Interpreter/Exception.cpp b/interpreter/cling/lib/Interpreter/Exception.cpp
index 417585b686b8bb5befacb2712110948e0bf529ff..2c5b0bf48f8abe9b4c168ff47f9ee627e54ea81b 100644
--- a/interpreter/cling/lib/Interpreter/Exception.cpp
+++ b/interpreter/cling/lib/Interpreter/Exception.cpp
@@ -61,7 +61,7 @@ namespace cling {
     std::runtime_error(What), m_Sema(S) {}
 
   bool InterpreterException::diagnose() const { return false; }
-  InterpreterException::~InterpreterException() LLVM_NOEXCEPT {}
+  InterpreterException::~InterpreterException() noexcept {}
 
 
   InvalidDerefException::InvalidDerefException(clang::Sema* S,
@@ -73,7 +73,7 @@ namespace cling {
       "non-null arguments", S),
     m_Arg(E), m_Type(type) {}
 
-  InvalidDerefException::~InvalidDerefException() LLVM_NOEXCEPT {}
+  InvalidDerefException::~InvalidDerefException() noexcept {}
 
   bool InvalidDerefException::diagnose() const {
     // Construct custom diagnostic: warning for invalid memory address;
@@ -94,7 +94,7 @@ namespace cling {
   CompilationException::CompilationException(const std::string& Reason) :
     InterpreterException(Reason) {}
 
-  CompilationException::~CompilationException() LLVM_NOEXCEPT {}
+  CompilationException::~CompilationException() noexcept {}
 
   void CompilationException::throwingHandler(void * /*user_data*/,
                                              const std::string& reason,
diff --git a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp
index 96eb9f0f00550187e8ae943e9971a1e64c6b6b67..b7a4616ef180210b9a0d7183b703aa2566e4c375 100644
--- a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp
+++ b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp
@@ -206,8 +206,8 @@ namespace cling {
       FE = PP.LookupFile(fileNameLoc, FileName, isAngled,
                           FromDir, FromFile, CurDir, /*SearchPath*/0,
                           /*RelativePath*/ 0, /*suggestedModule*/0,
-                          /*SkipCache*/ false, /*OpenFile*/ false,
-                          /*CacheFail*/ true);
+                          /*IsMapped*/0, /*SkipCache*/ false,
+                          /*OpenFile*/ false, /*CacheFail*/ true);
       // Return true if we can '#include' the given filename
       return FE != nullptr;
     };
diff --git a/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp b/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
index 0da6e5f12e27635c2fee4699a1425241d39544ff..a6d53d441bc780f65f6caea74d152ce1d36d961b 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
+++ b/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
@@ -18,6 +18,7 @@
 #include "cling/Utils/Platform.h"
 
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/TargetOptions.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "clang/Frontend/CompilerInstance.h"
 
diff --git a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
index e15698f3f3176e794cde6baf072111d42fda9d5e..ee0e2885040b4ca9841471a4656565a68a9b7da9 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
+++ b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
@@ -41,7 +41,7 @@ public:
   class NotifyFinalizedT {
   public:
     NotifyFinalizedT(cling::IncrementalJIT &jit) : m_JIT(jit) {}
-    void operator()(llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT H) {
+    void operator()(llvm::orc::RTDyldObjectLinkingLayerBase::ObjSetHandleT H) {
       m_JIT.RemoveUnfinalizedSection(H);
     }
 
@@ -205,12 +205,11 @@ public:
 #endif
   }
 
-  void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr,
-                          size_t Size) override {
+  void deregisterEHFrames() override {
 #ifdef LLVM_ON_WIN32
     platform::DeRegisterEHFrames(Addr, Size);
 #else
-    return getExeMM()->deregisterEHFrames(Addr, LoadAddr, Size);
+    return getExeMM()->deregisterEHFrames();
 #endif
   }
 
@@ -294,9 +293,9 @@ IncrementalJIT::IncrementalJIT(IncrementalExecutor& exe,
 }
 
 
-llvm::orc::JITSymbol
+llvm::JITSymbol
 IncrementalJIT::getInjectedSymbols(const std::string& Name) const {
-  using JITSymbol = llvm::orc::JITSymbol;
+  using JITSymbol = llvm::JITSymbol;
   auto SymMapI = m_SymbolMap.find(Name);
   if (SymMapI != m_SymbolMap.end())
     return JITSymbol(SymMapI->second, llvm::JITSymbolFlags::Exported);
@@ -319,7 +318,7 @@ IncrementalJIT::lookupSymbol(llvm::StringRef Name, void *InAddr, bool Jit) {
 #ifdef MANGLE_PREFIX
       Key.insert(0, MANGLE_PREFIX);
 #endif
-      m_SymbolMap[Key] = llvm::orc::TargetAddress(InAddr);
+      m_SymbolMap[Key] = llvm::JITTargetAddress(InAddr);
     }
     llvm::sys::DynamicLibrary::AddSymbol(Name, InAddr);
     return std::make_pair(InAddr, true);
@@ -327,16 +326,16 @@ IncrementalJIT::lookupSymbol(llvm::StringRef Name, void *InAddr, bool Jit) {
   return std::make_pair(Addr, false);
 }
     
-llvm::orc::JITSymbol
+llvm::JITSymbol
 IncrementalJIT::getSymbolAddressWithoutMangling(const std::string& Name,
                                                 bool AlsoInProcess) {
   if (auto Sym = getInjectedSymbols(Name))
     return Sym;
 
   if (AlsoInProcess) {
-    if (RuntimeDyld::SymbolInfo SymInfo = m_ExeMM->findSymbol(Name))
-      return llvm::orc::JITSymbol(SymInfo.getAddress(),
-                                  llvm::JITSymbolFlags::Exported);
+    if (llvm::JITSymbol SymInfo = m_ExeMM->findSymbol(Name))
+      return llvm::JITSymbol(SymInfo.getAddress(),
+                             llvm::JITSymbolFlags::Exported);
 #ifdef LLVM_ON_WIN32
     // FIXME: DLSym symbol lookup can overlap m_ExeMM->findSymbol wasting time
     // looking for a symbol in libs where it is already known not to exist.
@@ -346,15 +345,15 @@ IncrementalJIT::getSymbolAddressWithoutMangling(const std::string& Name,
     // An upside to doing it this way is RTLD_GLOBAL won't need to be used
     // allowing libs with competing symbols to co-exists.
     if (const void* Sym = platform::DLSym(Name))
-      return llvm::orc::JITSymbol(llvm::orc::TargetAddress(Sym),
-                                  llvm::JITSymbolFlags::Exported);
+      return llvm::JITSymbol(llvm::JITTargetAddress(Sym),
+                             llvm::JITSymbolFlags::Exported);
 #endif
   }
 
   if (auto Sym = m_LazyEmitLayer.findSymbol(Name, false))
     return Sym;
 
-  return llvm::orc::JITSymbol(nullptr);
+  return llvm::JITSymbol(nullptr);
 }
 
 size_t IncrementalJIT::addModules(std::vector<llvm::Module*>&& modules) {
@@ -368,14 +367,12 @@ size_t IncrementalJIT::addModules(std::vector<llvm::Module*>&& modules) {
   auto Resolver = llvm::orc::createLambdaResolver(
     [&](const std::string &S) {
       if (auto Sym = getInjectedSymbols(S))
-        return RuntimeDyld::SymbolInfo((uint64_t)Sym.getAddress(),
-                                       Sym.getFlags());
+        return JITSymbol((uint64_t)Sym.getAddress(), Sym.getFlags());
       return m_ExeMM->findSymbol(S);
     },
     [&](const std::string &Name) {
       if (auto Sym = getSymbolAddressWithoutMangling(Name, true))
-        return RuntimeDyld::SymbolInfo(Sym.getAddress(),
-                                       Sym.getFlags());
+        return JITSymbol(Sym.getAddress(), Sym.getFlags());
 
       const std::string* NameNP = &Name;
 #ifdef MANGLE_PREFIX
@@ -393,7 +390,7 @@ size_t IncrementalJIT::addModules(std::vector<llvm::Module*>&& modules) {
       /// It is used to resolve symbols during module linking.
 
       uint64_t addr = uint64_t(getParent().NotifyLazyFunctionCreators(*NameNP));
-      return RuntimeDyld::SymbolInfo(addr, llvm::JITSymbolFlags::Weak);
+      return JITSymbol(addr, llvm::JITSymbolFlags::Weak);
     });
 
   ModuleSetHandleT MSHandle
diff --git a/interpreter/cling/lib/Interpreter/IncrementalJIT.h b/interpreter/cling/lib/Interpreter/IncrementalJIT.h
index fcb4af150ac423af32785f8625920b12e4726328..54b2f1aa51c6f1b4d701fb3eb58d659077271a54 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalJIT.h
+++ b/interpreter/cling/lib/Interpreter/IncrementalJIT.h
@@ -21,10 +21,11 @@
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/ExecutionEngine/JITEventListener.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
 #include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
-#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
+#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
 #include "llvm/Target/TargetMachine.h"
 
@@ -39,7 +40,7 @@ class IncrementalExecutor;
 
 class IncrementalJIT {
 public:
-  using SymbolMapT = llvm::StringMap<llvm::orc::TargetAddress>;
+  using SymbolMapT = llvm::StringMap<llvm::JITTargetAddress>;
 
 private:
   friend class Azog;
@@ -58,7 +59,7 @@ private:
 
     NotifyObjectLoadedT(IncrementalJIT &jit) : m_JIT(jit) {}
 
-    void operator()(llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT H,
+    void operator()(llvm::orc::RTDyldObjectLinkingLayerBase::ObjSetHandleT H,
                     const ObjListT &Objects,
                     const LoadedObjInfoListT &Infos) const
     {
@@ -87,9 +88,9 @@ private:
             continue;
           auto Name = NameOrError.get();
           if (m_JIT.m_SymbolMap.find(Name) == m_JIT.m_SymbolMap.end()) {
-            llvm::orc::JITSymbol Sym
+            llvm::JITSymbol Sym
               = m_JIT.m_CompileLayer.findSymbolIn(H, Name, true);
-            if (llvm::orc::TargetAddress Addr = Sym.getAddress())
+            if (llvm::JITTargetAddress Addr = Sym.getAddress())
               m_JIT.m_SymbolMap[Name] = Addr;
           }
         }
@@ -101,9 +102,9 @@ private:
   };
 
   class RemovableObjectLinkingLayer:
-    public llvm::orc::ObjectLinkingLayer<NotifyObjectLoadedT> {
+    public llvm::orc::RTDyldObjectLinkingLayer<NotifyObjectLoadedT> {
   public:
-    using Base_t = llvm::orc::ObjectLinkingLayer<NotifyObjectLoadedT>;
+    using Base_t = llvm::orc::RTDyldObjectLinkingLayer<NotifyObjectLoadedT>;
     using NotifyLoadedFtor = NotifyObjectLoadedT;
     using NotifyFinalizedFtor = Base_t::NotifyFinalizedFtor;
     RemovableObjectLinkingLayer(SymbolMapT &SymMap,
@@ -112,11 +113,11 @@ private:
       Base_t(NotifyLoaded, NotifyFinalized), m_SymbolMap(SymMap)
     {}
 
-    void removeObjectSet(llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT H) {
+    void
+    removeObjectSet(llvm::orc::RTDyldObjectLinkingLayerBase::ObjSetHandleT H) {
       struct AccessSymbolTable: public LinkedObjectSet {
-        const llvm::StringMap<llvm::RuntimeDyld::SymbolInfo>&
-        getSymbolTable() const
-        {
+        const llvm::StringMap<llvm::JITEvaluatedSymbol>&
+        getSymbolTable() const {
           return SymbolTable;
         }
       };
@@ -130,7 +131,7 @@ private:
         if (iterSymMap->second == NameSym.second.getAddress())
           m_SymbolMap.erase(iterSymMap);
       }
-      llvm::orc::ObjectLinkingLayer<NotifyObjectLoadedT>::removeObjectSet(H);
+      llvm::orc::RTDyldObjectLinkingLayer<NotifyObjectLoadedT>::removeObjectSet(H);
     }
   private:
     SymbolMapT& m_SymbolMap;
@@ -179,7 +180,7 @@ private:
     return MangledName.str();
   }
 
-  llvm::orc::JITSymbol getInjectedSymbols(const std::string& Name) const;
+  llvm::JITSymbol getInjectedSymbols(const std::string& Name) const;
 
 public:
   IncrementalJIT(IncrementalExecutor& exe,
@@ -199,7 +200,7 @@ public:
 
   ///\brief Get the address of a symbol from the JIT or the memory manager.
   /// Use this to resolve symbols of known, target-specific names.
-  llvm::orc::JITSymbol getSymbolAddressWithoutMangling(const std::string& Name,
+  llvm::JITSymbol getSymbolAddressWithoutMangling(const std::string& Name,
                                                        bool AlsoInProcess);
 
   size_t addModules(std::vector<llvm::Module*>&& modules);
@@ -207,8 +208,8 @@ public:
 
   IncrementalExecutor& getParent() const { return m_Parent; }
 
-  void
-  RemoveUnfinalizedSection(llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT H) {
+  void RemoveUnfinalizedSection(
+                     llvm::orc::RTDyldObjectLinkingLayerBase::ObjSetHandleT H) {
     m_UnfinalizedSections.erase(H);
   }
 
diff --git a/interpreter/cling/lib/Interpreter/IncrementalParser.cpp b/interpreter/cling/lib/Interpreter/IncrementalParser.cpp
index 469e15113a617b029f435bbc2e1dff55f33c0e49..673bb853b33542091c0debd2486b078fe2317123 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalParser.cpp
+++ b/interpreter/cling/lib/Interpreter/IncrementalParser.cpp
@@ -39,6 +39,7 @@
 #include "clang/CodeGen/ModuleBuilder.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/Parser.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaDiagnostic.h"
diff --git a/interpreter/cling/lib/Interpreter/Interpreter.cpp b/interpreter/cling/lib/Interpreter/Interpreter.cpp
index 3c1d553c7773fe7f49d89c3556d0c812170adc01..6c95c560e72dfe83052c0d67fa8c69ad9a50b39a 100644
--- a/interpreter/cling/lib/Interpreter/Interpreter.cpp
+++ b/interpreter/cling/lib/Interpreter/Interpreter.cpp
@@ -488,7 +488,8 @@ namespace cling {
     if (what.equals("asttree")) {
       std::unique_ptr<clang::ASTConsumer> printer =
           clang::CreateASTDumper(filter, true  /*DumpDecls*/,
-                                         false /*DumpLookups*/ );
+                                         false /*Deserialize*/,
+                                         false /*DumpLookups*/);
       printer->HandleTranslationUnit(getSema().getASTContext());
     } else if (what.equals("ast"))
       getSema().getASTContext().PrintStats();
@@ -654,6 +655,7 @@ namespace cling {
     SourceLocation fileNameLoc;
     PP.LookupFile(fileNameLoc, headerFile, isAngled, FromDir, FromFile, CurDir,
                   /*SearchPath*/0, /*RelativePath*/ 0, &suggestedModule,
+                  0 /*IsMapped*/,
                   /*SkipCache*/false, /*OpenFile*/ false, /*CacheFail*/ false);
     if (!suggestedModule)
       return Interpreter::kFailure;
@@ -1188,7 +1190,7 @@ namespace cling {
     SourceLocation fileNameLoc;
     FE = PP.LookupFile(fileNameLoc, canonicalFile, isAngled, FromDir, FromFile,
                        CurDir, /*SearchPath*/0, /*RelativePath*/ 0,
-                       /*suggestedModule*/0, /*SkipCache*/false,
+                       /*suggestedModule*/0, 0 /*IsMapped*/, /*SkipCache*/false,
                        /*OpenFile*/ false, /*CacheFail*/ false);
     if (FE)
       return FE->getName();
diff --git a/interpreter/cling/lib/Interpreter/LookupHelper.cpp b/interpreter/cling/lib/Interpreter/LookupHelper.cpp
index 4cd1643d994c77a4f14d48ea2a257914fd42fc26..2d0e02f087a3778c99b0588110b1aeea245958d7 100644
--- a/interpreter/cling/lib/Interpreter/LookupHelper.cpp
+++ b/interpreter/cling/lib/Interpreter/LookupHelper.cpp
@@ -687,7 +687,7 @@ namespace cling {
     //
     //  Now try to parse the name as a type.
     //
-    if (P.TryAnnotateTypeOrScopeToken(false, false)) {
+    if (P.TryAnnotateTypeOrScopeToken()) {
       // error path
       return 0;
     }
@@ -741,7 +741,7 @@ namespace cling {
     //
     //  Now try to parse the name as a type.
     //
-    if (P.TryAnnotateTypeOrScopeToken(false, false)) {
+    if (P.TryAnnotateTypeOrScopeToken()) {
       // error path
       return 0;
     }
@@ -1268,6 +1268,7 @@ namespace cling {
     if (P.ParseUnqualifiedId(SS, /*EnteringContext*/false,
                              /*AllowDestructorName*/true,
                              /*AllowConstructorName*/true,
+                             /*AllowDeductionGuide*/ false,
                              ParsedType(), TemplateKWLoc,
                              FuncId)) {
       // Failed parse, cleanup.
diff --git a/interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.cpp b/interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.cpp
index 6968182bddbfa53a1c4250b37a3601ba7854f70e..9245ff2f4b2ea79ec20221bba5e6bd9bc986e954 100644
--- a/interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.cpp
+++ b/interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.cpp
@@ -323,8 +323,7 @@ namespace {
                                    /*allocTypeInfo*/ETSI,
                                    /*arraySize*/0,
                                    /*directInitRange*/E->getSourceRange(),
-                                   /*initializer*/E,
-                                   /*mayContainAuto*/false
+                                   /*initializer*/E
                                    );
         // Handle possible cleanups:
         Call = m_Sema->ActOnFinishFullExpr(Call.get());
diff --git a/interpreter/cling/lib/Utils/AST.cpp b/interpreter/cling/lib/Utils/AST.cpp
index e3d1a8aecbd3f2d6555d6c952908523a89bfbc41..6d46522ab53f238fc8539a086eeb6c4339baea9c 100644
--- a/interpreter/cling/lib/Utils/AST.cpp
+++ b/interpreter/cling/lib/Utils/AST.cpp
@@ -290,7 +290,7 @@ namespace utils {
       if (mightHaveChanged) {
         QualType QT
           = Ctx.getTemplateSpecializationType(TST->getTemplateName(),
-                                              desArgs.data(), desArgs.size(),
+                                              desArgs,
                                               TST->getCanonicalTypeInternal());
         return QT.getTypePtr();
       }
@@ -323,9 +323,7 @@ namespace utils {
           if (mightHaveChanged) {
             TemplateName TN(TSTdecl->getSpecializedTemplate());
             QualType QT
-              = Ctx.getTemplateSpecializationType(TN,
-                                                  desArgs.data(),
-                                                  desArgs.size(),
+              = Ctx.getTemplateSpecializationType(TN, desArgs,
                                          TSTRecord->getCanonicalTypeInternal());
             return QT.getTypePtr();
           }
@@ -1316,8 +1314,7 @@ namespace utils {
       if (mightHaveChanged) {
         Qualifiers qualifiers = QT.getLocalQualifiers();
         QT = Ctx.getTemplateSpecializationType(TST->getTemplateName(),
-                                               desArgs.data(),
-                                               desArgs.size(),
+                                               desArgs,
                                                TST->getCanonicalTypeInternal());
         QT = Ctx.getQualifiedType(QT, qualifiers);
       }
@@ -1389,8 +1386,7 @@ namespace utils {
           if (mightHaveChanged) {
             Qualifiers qualifiers = QT.getLocalQualifiers();
             TemplateName TN(TSTdecl->getSpecializedTemplate());
-            QT = Ctx.getTemplateSpecializationType(TN, desArgs.data(),
-                                                   desArgs.size(),
+            QT = Ctx.getTemplateSpecializationType(TN, desArgs,
                                          TSTRecord->getCanonicalTypeInternal());
             QT = Ctx.getQualifiedType(QT, qualifiers);
           }
diff --git a/interpreter/cling/test/Lookup/func.C b/interpreter/cling/test/Lookup/func.C
index 92ca3fa74b1b7bc8944f71d6855b56815a38f970..b507ddf7d8b72a4c0f937e3e1a59b98d64bcaaf6 100644
--- a/interpreter/cling/test/Lookup/func.C
+++ b/interpreter/cling/test/Lookup/func.C
@@ -292,14 +292,14 @@ const clang::FunctionDecl* G_d1_proto = lookup.findFunctionProto(G, "G_d<int>",
 printf("G_d1_args: 0x%lx\n", (unsigned long) G_d1_args);
 //CHECK: G_d1_args: 0x{{[1-9a-f][0-9a-f]*$}}
 G_d1_args->print(cling::outs());
-//CHECK-NEXT: void G_d(int v) {
+//CHECK-NEXT: template<> void G_d<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
 printf("G_d1_proto: 0x%lx\n", (unsigned long) G_d1_proto);
 //CHECK: G_d1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 G_d1_proto->print(cling::outs());
-//CHECK-NEXT: void G_d(int v) {
+//CHECK-NEXT: template<> void G_d<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
@@ -309,14 +309,14 @@ const clang::FunctionDecl* G_d2_proto = lookup.findFunctionProto(G, "G_d<double>
 printf("G_d2_args: 0x%lx\n", (unsigned long) G_d2_args);
 //CHECK: G_d2_args: 0x{{[1-9a-f][0-9a-f]*$}}
 G_d2_args->print(cling::outs());
-//CHECK-NEXT: void G_d(double v) {
+//CHECK-NEXT: template<> void G_d<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
 printf("G_d2_proto: 0x%lx\n", (unsigned long) G_d2_proto);
 //CHECK: G_d2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 G_d2_proto->print(cling::outs());
-//CHECK-NEXT: void G_d(double v) {
+//CHECK-NEXT: template<> void G_d<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
@@ -447,14 +447,14 @@ const clang::FunctionDecl* H_d1_proto = lookup.findFunctionProto(namespace_N, "H
 printf("H_d1_args: 0x%lx\n", (unsigned long) H_d1_args);
 //CHECK: H_d1_args: 0x{{[1-9a-f][0-9a-f]*$}}
 H_d1_args->print(cling::outs());
-//CHECK-NEXT: void H_d(int v) {
+//CHECK-NEXT: template<> void H_d<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
 printf("H_d1_proto: 0x%lx\n", (unsigned long) H_d1_proto);
 //CHECK: H_d1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 H_d1_proto->print(cling::outs());
-//CHECK-NEXT: void H_d(int v) {
+//CHECK-NEXT: template<> void H_d<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
@@ -464,14 +464,14 @@ const clang::FunctionDecl* H_d2_proto = lookup.findFunctionProto(namespace_N, "H
 printf("H_d2_args: 0x%lx\n", (unsigned long) H_d2_args);
 //CHECK: H_d2_args: 0x{{[1-9a-f][0-9a-f]*$}}
 H_d2_args->print(cling::outs());
-//CHECK-NEXT: void H_d(double v) {
+//CHECK-NEXT: template<> void H_d<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
 printf("H_d2_proto: 0x%lx\n", (unsigned long) H_d2_proto);
 //CHECK: H_d2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 H_d2_proto->print(cling::outs());
-//CHECK-NEXT: void H_d(double v) {
+//CHECK-NEXT: template<> void H_d<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
@@ -602,14 +602,14 @@ const clang::FunctionDecl* func_A_k1_proto = lookup.findFunctionProto(class_A, "
 printf("func_A_k1_args: 0x%lx\n", (unsigned long) func_A_k1_args);
 //CHECK: func_A_k1_args: 0x{{[1-9a-f][0-9a-f]*$}}
 func_A_k1_args->print(cling::outs());
-//CHECK-NEXT: void A_k(int v) {
+//CHECK-NEXT: template<> void A_k<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
 printf("func_A_k1_proto: 0x%lx\n", (unsigned long) func_A_k1_proto);
 //CHECK: func_A_k1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 func_A_k1_proto->print(cling::outs());
-//CHECK-NEXT: void A_k(int v) {
+//CHECK-NEXT: template<> void A_k<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
@@ -619,14 +619,14 @@ const clang::FunctionDecl* func_A_k2_proto = lookup.findFunctionProto(class_A, "
 printf("func_A_k2_args: 0x%lx\n", (unsigned long) func_A_k2_args);
 //CHECK: func_A_k2_args: 0x{{[1-9a-f][0-9a-f]*$}}
 func_A_k2_args->print(cling::outs());
-//CHECK-NEXT: void A_k(double v) {
+//CHECK-NEXT: template<> void A_k<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
 printf("func_A_k2_proto: 0x%lx\n", (unsigned long) func_A_k2_proto);
 //CHECK: func_A_k2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 func_A_k2_proto->print(cling::outs());
-//CHECK-NEXT: void A_k(double v) {
+//CHECK-NEXT: template<> void A_k<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
@@ -850,14 +850,14 @@ const clang::FunctionDecl* func_B_k1_proto = lookup.findFunctionProto(class_A, "
 printf("func_B_k1_args: 0x%lx\n", (unsigned long) func_B_k1_args);
 //CHECK: func_B_k1_args: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k1_args->print(cling::outs());
-//CHECK-NEXT: void B_k(int v) {
+//CHECK-NEXT: template<> void B_k<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
 printf("func_B_k1_proto: 0x%lx\n", (unsigned long) func_B_k1_proto);
 //CHECK: func_B_k1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k1_proto->print(cling::outs());
-//CHECK-NEXT: void B_k(int v) {
+//CHECK-NEXT: template<> void B_k<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }
 
@@ -867,14 +867,14 @@ const clang::FunctionDecl* func_B_k2_proto = lookup.findFunctionProto(class_A, "
 printf("func_B_k2_args: 0x%lx\n", (unsigned long) func_B_k2_args);
 //CHECK: func_B_k2_args: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k2_args->print(cling::outs());
-//CHECK-NEXT: void B_k(double v) {
+//CHECK-NEXT: template<> void B_k<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
 printf("func_B_k2_proto: 0x%lx\n", (unsigned long) func_B_k2_proto);
 //CHECK: func_B_k2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k2_proto->print(cling::outs());
-//CHECK-NEXT: void B_k(double v) {
+//CHECK-NEXT: template<> void B_k<double>(double v) {
 //CHECK-NEXT:     double x = v;
 //CHECK-NEXT: }
 
@@ -1057,7 +1057,7 @@ const clang::FunctionDecl* func_B_ctr4_proto = lookup.findFunctionProto(class_B,
 dumpDecl("func_B_ctr4_args", func_B_ctr4_args);
 //CHECK: func_B_ctr4_args: 0x{{[1-9a-f][0-9a-f]*$}}
 //CHECK-NEXT: func_B_ctr4_args name: B::B<char>
-//CHECK-NEXT: B(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
+//CHECK-NEXT: template<> B<char>(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
 //CHECK-NEXT:     this->m_B_i = (long)(char *)v;
 //CHECK-NEXT:     this->m_B_d = 1.;
 //CHECK-NEXT: }
@@ -1065,7 +1065,7 @@ dumpDecl("func_B_ctr4_args", func_B_ctr4_args);
 dumpDecl("func_B_ctr4_proto", func_B_ctr4_proto);
 //CHECK: func_B_ctr4_proto: 0x{{[1-9a-f][0-9a-f]*$}}
 //CHECK-NEXT: func_B_ctr4_proto name: B::B<char>
-//CHECK-NEXT: B(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
+//CHECK-NEXT: template<> B<char>(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
 //CHECK-NEXT:     this->m_B_i = (long)(char *)v;
 //CHECK-NEXT:     this->m_B_d = 1.;
 //CHECK-NEXT: }
@@ -1304,7 +1304,7 @@ const clang::FunctionDecl* func_B_k1_name = lookup.findAnyFunction(class_A, "B_k
 printf("func_B_k1_name: 0x%lx\n", (unsigned long) func_B_k1_name);
 //CHECK: func_B_k1_name: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k1_name->print(cling::outs());
-//CHECK-NEXT: void B_k(float v) {
+//CHECK-NEXT: template<> void B_k<float>(float v) {
 //CHECK-NEXT:     float x = v;
 //CHECK-NEXT: }
 
@@ -1313,7 +1313,7 @@ const clang::FunctionDecl* func_B_k1_name_2 = lookup.findAnyFunction(class_A, "B
 printf("func_B_k1_name_2: 0x%lx\n", (unsigned long) func_B_k1_name_2);
 //CHECK: func_B_k1_name_2: 0x{{[1-9a-f][0-9a-f]*$}}
 func_B_k1_name_2->print(cling::outs());
-//CHECK-NEXT: void B_k(int v) {
+//CHECK-NEXT: template<> void B_k<int>(int v) {
 //CHECK-NEXT:     int x = v;
 //CHECK-NEXT: }