diff --git a/CMakeLists.txt b/CMakeLists.txt index fe8874ea5..fa9e45210 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,10 +5,10 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) cmake_minimum_required(VERSION 3.4.3) find_package(Subversion) - find_package(LLVM 5.0 REQUIRED CONFIG PATHS ${CLAD_PATH_TO_LLVM_BUILD} NO_DEFAULT_PATH) + find_package(LLVM 6.0 REQUIRED CONFIG PATHS ${CLAD_PATH_TO_LLVM_BUILD} NO_DEFAULT_PATH) # We cannot use find_package(Clang) or include(ClangConfig) because we require - # a specific version (currently 5.0) and ClangConfig.cmake tries to do + # a specific version (currently 6.0) and ClangConfig.cmake tries to do # find_package(LLVM REQUIRED CONFIG...) which in certain cases resolves to the # wrong LLVM version. # FIXME: That may be a bug in ClangConfig.cmake. diff --git a/README.md b/README.md index 9b4386f21..aab4f5d8c 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Note: Clad provides custom derivatives for some mathematical functions from ` clang::CompoundStmt* MakeCompoundStmt(const Range & Stmts) { auto Stmts_ref = llvm::makeArrayRef(Stmts.data(), Stmts.size()); - return new (m_Context) clang::CompoundStmt(m_Context, - Stmts_ref, - noLoc, - noLoc); + return clang::CompoundStmt::Create(m_Context, Stmts_ref, + noLoc, noLoc); } /// Get the latest block of code (i.e. place for statements output). diff --git a/lib/Differentiator/DerivativeBuilder.cpp b/lib/Differentiator/DerivativeBuilder.cpp index 3b6d18bf8..cea2877e9 100644 --- a/lib/Differentiator/DerivativeBuilder.cpp +++ b/lib/Differentiator/DerivativeBuilder.cpp @@ -230,7 +230,7 @@ namespace clad { // From Sema::ActOnStartNamespaceDef: if (II) { LookupResult R(m_Sema, II, noLoc, Sema::LookupOrdinaryName, - Sema::ForRedeclaration); + Sema::ForVisibleRedeclaration); m_Sema.LookupQualifiedName(R, m_Sema.CurContext->getRedeclContext()); NamedDecl* FoundDecl = R.isSingleResult() ? R.getRepresentativeDecl() : nullptr; @@ -620,10 +620,8 @@ namespace clad { auto StmtsRef = llvm::makeArrayRef(CompStmtSave.data(), CompStmtSave.size()); - CompoundStmt* CS = new (m_Context) clang::CompoundStmt(m_Context, - StmtsRef, - noLoc, - noLoc); + CompoundStmt* CS = clang::CompoundStmt::Create(m_Context, StmtsRef, + noLoc, noLoc); hessianFD->setBody(CS); endScope(); // Function body scope m_Sema.PopFunctionScopeInfo(); @@ -863,7 +861,7 @@ namespace clad { return Result; DeclarationName CladName = &m_Context.Idents.get("clad"); LookupResult CladR(m_Sema, CladName, noLoc, Sema::LookupNamespaceName, - Sema::ForRedeclaration); + Sema::ForVisibleRedeclaration); m_Sema.LookupQualifiedName(CladR, m_Context.getTranslationUnitDecl()); assert(!CladR.empty() && "cannot find clad namespace"); Result = cast(CladR.getFoundDecl()); @@ -879,7 +877,7 @@ namespace clad { CSS.Extend(m_Context, CladNS, noLoc, noLoc); DeclarationName TapeName = &m_Context.Idents.get("tape"); LookupResult TapeR(m_Sema, TapeName, noLoc, Sema::LookupUsingDeclName, - Sema::ForRedeclaration); + Sema::ForVisibleRedeclaration); m_Sema.LookupQualifiedName(TapeR, CladNS, CSS); assert(!TapeR.empty() && isa(TapeR.getFoundDecl()) && "cannot find clad::tape"); @@ -1120,7 +1118,7 @@ namespace clad { Intro.Range.setEnd(E->getLocEnd()); AttributeFactory AttrFactory; DeclSpec DS(AttrFactory); - Declarator D(DS, Declarator::LambdaExprContext); + Declarator D(DS, DeclaratorContext::LambdaExprContext); S.PushLambdaScope(); V.beginScope(Scope::BlockScope | Scope::FnScope | Scope::DeclScope); S.ActOnStartOfLambdaDefinition(Intro, D, V.getCurrentScope()); @@ -1393,7 +1391,7 @@ namespace clad { // Find the builtin derivatives namespace DeclarationName Name = &C.Idents.get("custom_derivatives"); LookupResult R(S, Name, SourceLocation(), Sema::LookupNamespaceName, - Sema::ForRedeclaration); + Sema::ForVisibleRedeclaration); S.LookupQualifiedName(R, C.getTranslationUnitDecl(), /*allowBuiltinCreation*/ false); assert(!R.empty() && "Cannot find builtin derivatives!"); diff --git a/lib/Differentiator/StmtClone.cpp b/lib/Differentiator/StmtClone.cpp index c63fd3dc9..3dae2c008 100644 --- a/lib/Differentiator/StmtClone.cpp +++ b/lib/Differentiator/StmtClone.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD //--------------------------------------------------------------------*- C++ -*- // clad - the C++ Clang-based Automatic Differentiator // author: Vassil Vassilev @@ -279,8 +280,8 @@ Stmt* StmtClone::VisitCompoundStmt(CompoundStmt *Node) { llvm::ArrayRef stmtsRef = llvm::makeArrayRef(clonedBody.data(), clonedBody.size()); - return new (Ctx) CompoundStmt(Ctx, stmtsRef, Node->getLBracLoc(), - Node->getLBracLoc()); + return CompoundStmt::Create(Ctx, stmtsRef, Node->getLBracLoc(), + Node->getLBracLoc()); } VarDecl* StmtClone::CloneDeclOrNull(VarDecl* Node) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5e9e71b98..5e01bac69 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,7 +18,7 @@ if(CLAD_BUILT_STANDALONE) # cmake will fall back to LLVM-config (asking llvm-config --obj-root) and this # will return a build folder. This information will force lit to look for # utils such as FileCheck in /usr/local/... instead of the true location in - # /usr/lib/llvm-5.0/ + # /usr/lib/llvm-6.0/ set(LLVM_BINARY_DIR ${LLVM_INSTALL_PREFIX}) set(LLVM_TOOLS_DIR ${LLVM_INSTALL_PREFIX}) set(LLVM_LIBS_DIR ${LLVM_INSTALL_PREFIX}/lib/) @@ -54,7 +54,7 @@ if(NOT LLVM_MAIN_SRC_DIR) endif() add_lit_testsuite(check-clad "Running the Clad regression tests" ${CMAKE_CURRENT_BINARY_DIR} - #LIT ${LIT_COMMAND} + LIT ${LIT_COMMAND} PARAMS ${CLAD_TEST_PARAMS} DEPENDS ${CLAD_TEST_DEPS} ARGS ${CLAD_TEST_EXTRA_ARGS} --verbose --succinct diff --git a/tools/ClangPlugin.cpp b/tools/ClangPlugin.cpp index 224952cf4..51307d8df 100644 --- a/tools/ClangPlugin.cpp +++ b/tools/ClangPlugin.cpp @@ -183,7 +183,7 @@ namespace clad { DeclarationName Name = &C.Idents.get("clad"); Sema &SemaR = m_CI.getSema(); LookupResult R(SemaR, Name, SourceLocation(), Sema::LookupNamespaceName, - Sema::ForRedeclaration); + Sema::ForVisibleRedeclaration); SemaR.LookupQualifiedName(R, C.getTranslationUnitDecl(), /*allowBuiltinCreation*/ false); m_HasRuntime = !R.empty();