Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] Add clang 18 support #824

Merged
merged 4 commits into from
Apr 1, 2024
Merged

Conversation

mcbarton
Copy link
Contributor

This PR will add support for clang 18
Fixes #805

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 83.58209% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 94.77%. Comparing base (5b66f0e) to head (44a7a44).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #824      +/-   ##
==========================================
- Coverage   94.82%   94.77%   -0.06%     
==========================================
  Files          49       49              
  Lines        7501     7499       -2     
==========================================
- Hits         7113     7107       -6     
- Misses        388      392       +4     
Files Coverage Δ
include/clad/Differentiator/StmtClone.h 77.77% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <100.00%> (ø)
lib/Differentiator/BaseForwardModeVisitor.cpp 99.06% <100.00%> (ø)
lib/Differentiator/CladUtils.cpp 92.98% <100.00%> (-0.02%) ⬇️
lib/Differentiator/DiffPlanner.cpp 98.59% <100.00%> (+0.01%) ⬆️
lib/Differentiator/HessianModeVisitor.cpp 99.45% <100.00%> (-0.01%) ⬇️
lib/Differentiator/ReverseModeForwPassVisitor.cpp 100.00% <100.00%> (ø)
lib/Differentiator/ReverseModeVisitor.cpp 97.21% <100.00%> (+<0.01%) ⬆️
lib/Differentiator/VisitorBase.cpp 95.95% <100.00%> (+<0.01%) ⬆️
tools/ClangPlugin.cpp 96.51% <100.00%> (ø)
... and 2 more
Files Coverage Δ
include/clad/Differentiator/StmtClone.h 77.77% <ø> (ø)
include/clad/Differentiator/VisitorBase.h 100.00% <100.00%> (ø)
lib/Differentiator/BaseForwardModeVisitor.cpp 99.06% <100.00%> (ø)
lib/Differentiator/CladUtils.cpp 92.98% <100.00%> (-0.02%) ⬇️
lib/Differentiator/DiffPlanner.cpp 98.59% <100.00%> (+0.01%) ⬆️
lib/Differentiator/HessianModeVisitor.cpp 99.45% <100.00%> (-0.01%) ⬇️
lib/Differentiator/ReverseModeForwPassVisitor.cpp 100.00% <100.00%> (ø)
lib/Differentiator/ReverseModeVisitor.cpp 97.21% <100.00%> (+<0.01%) ⬆️
lib/Differentiator/VisitorBase.cpp 95.95% <100.00%> (+<0.01%) ⬆️
tools/ClangPlugin.cpp 96.51% <100.00%> (ø)
... and 2 more

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

include/clad/Differentiator/Compatibility.h Outdated Show resolved Hide resolved
include/clad/Differentiator/Compatibility.h Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

return Ctx.getConstantArrayType(EltTy, ArySize, SizeExpr, ASM, IndexTypeQuals);
// clang 18 clang::ArrayType::ArraySizeModifier became clang::ArraySizeModifier
#if CLANG_VERSION_MAJOR < 18
static inline QualType getConstantArrayType(const ASTContext &Ctx,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unused function 'getConstantArrayType' [clang-diagnostic-unused-function]

   static inline QualType getConstantArrayType(const ASTContext &Ctx,
                          ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

lib/Differentiator/StmtClone.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
lib/Differentiator/CladUtils.cpp Outdated Show resolved Hide resolved
lib/Differentiator/HessianModeVisitor.cpp Outdated Show resolved Hide resolved
tools/ClangPlugin.cpp Outdated Show resolved Hide resolved
@mcbarton
Copy link
Contributor Author

@vgvassilev It is now building clad with clang-18 but it doesn't pass all the tests. It says that it is expected that 2 will fail, but 5 tests fail. Which 2 are expected to fail?

Copy link
Collaborator

@alexander-penev alexander-penev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some comments about Compatibility.h. It is good that some changes are made before we accept this PR.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

//Clang 18 ArrayType::Normal -> ArraySizeModifier::Normal

#if LLVM_VERSION_MAJOR < 18
const auto ArraySizeModifier_Normal = ArrayType::Normal;
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: reference to 'ArrayType' is ambiguous [clang-diagnostic-error]

const auto ArraySizeModifier_Normal = clang::ArrayType::Normal;
                                      ^
Additional context

llvm/include/clang/Sema/Sema.h:86: candidate found by name lookup is 'clang::ArrayType'

  class ArrayType;
        ^

llvm/include/llvm/Frontend/OpenMP/OMPConstants.h:24: candidate found by name lookup is 'llvm::ArrayType'

class ArrayType;
      ^

//Clang 18 ETK_None -> ElaboratedTypeKeyword::None

#if LLVM_VERSION_MAJOR < 18
const auto ElaboratedTypeKeyword_None ETK_None;
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: declaration of variable 'ElaboratedTypeKeyword_None' with deduced type 'const auto' requires an initializer [clang-diagnostic-error]

const auto ElaboratedTypeKeyword_None = ETK_None;
           ^

//Clang 18 ETK_None -> ElaboratedTypeKeyword::None

#if LLVM_VERSION_MAJOR < 18
const auto ElaboratedTypeKeyword_None ETK_None;
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: expected ';' after top level declarator [clang-diagnostic-error]

Suggested change
const auto ElaboratedTypeKeyword_None ETK_None;
const auto ElaboratedTypeKeyword_None = ETK_None;

@@ -166,7 +166,7 @@ namespace clad {
utils::BuildNNS(semaRef, const_cast<clang::DeclContext*>(declContext), CSS);
NestedNameSpecifier* NS = CSS.getScopeRep();
if (auto* Prefix = NS->getPrefix())
return C.getElaboratedType(ETK_None, Prefix, QT);
return C.getElaboratedType(ElaboratedTypeKeyword_None, Prefix, QT);
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ElaboratedTypeKeyword_None' [clang-diagnostic-error]

            return C.getElaboratedType(clad_compat::ElaboratedTypeKeyword_None, Prefix, QT);
                                       ^

@@ -273,7 +273,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ArrayType_Normal' [clang-diagnostic-error]

                                                    /*ASM=*/clad_compat::ArraySizeModifier_Normal,
                                                            ^

@@ -273,7 +273,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
/*IndexTypeQuals*/ 0);
StringLiteral* SL = StringLiteral::Create(C, str,
/*Kind=*/clad_compat::StringKind_Ordinary,
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no member named 'StringKind_Ordinary' in namespace 'clad_compat' [clang-diagnostic-error]

                                                /*Kind=*/clad_compat::StringLiteralKind_Ordinary,
                                                                      ^

@@ -41,7 +41,7 @@ namespace clad {
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ArrayType_Normal' [clang-diagnostic-error]

                                          /*ASM=*/clad_compat::ArraySizeModifier_Normal,
                                                  ^

@@ -41,7 +41,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
/*IndexTypeQuals*/ 0);
const StringLiteral* SL =
StringLiteral::Create(C, str, /*Kind=*/clad_compat::StringKind_Ordinary,
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no member named 'StringKind_Ordinary' in namespace 'clad_compat' [clang-diagnostic-error]

        StringLiteral::Create(C, str, /*Kind=*/clad_compat::StringLiteralKind_Ordinary,
                                                            ^

@@ -452,7 +452,7 @@ namespace clad {

// Create elaborated type with namespace specifier,
// i.e. class<T> -> clad::class<T>
return m_Context.getElaboratedType(ETK_None, NS, TT);
return m_Context.getElaboratedType(ElaboratedTypeKeyword_None, NS, TT);
Copy link
Contributor

@github-actions github-actions bot Mar 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ElaboratedTypeKeyword_None' [clang-diagnostic-error]

      return m_Context.getElaboratedType(clad_compat::ElaboratedTypeKeyword_None, NS, TT);
                                         ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -166,7 +166,7 @@ namespace clad {
utils::BuildNNS(semaRef, const_cast<clang::DeclContext*>(declContext), CSS);
NestedNameSpecifier* NS = CSS.getScopeRep();
if (auto* Prefix = NS->getPrefix())
return C.getElaboratedType(ETK_None, Prefix, QT);
return C.getElaboratedType(ElaboratedTypeKeyword_None, Prefix, QT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ElaboratedTypeKeyword_None'; did you mean 'clad_compat::ElaboratedTypeKeyword_None'? [clang-diagnostic-error]

Suggested change
return C.getElaboratedType(ElaboratedTypeKeyword_None, Prefix, QT);
return C.getElaboratedType(clad_compat::ElaboratedTypeKeyword_None, Prefix, QT);
Additional context

include/clad/Differentiator/Compatibility.h:100: 'clad_compat::ElaboratedTypeKeyword_None' declared here

const auto ElaboratedTypeKeyword_None = ETK_None;
           ^

@@ -273,7 +273,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ArrayType_Normal' [clang-diagnostic-error]

                                                    /*ASM=*/ArrayType_Normal,
                                                            ^

@@ -273,7 +273,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
/*IndexTypeQuals*/ 0);
StringLiteral* SL = StringLiteral::Create(C, str,
/*Kind=*/clad_compat::StringKind_Ordinary,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no member named 'StringKind_Ordinary' in namespace 'clad_compat' [clang-diagnostic-error]

                                                /*Kind=*/clad_compat::StringKind_Ordinary,
                                                                      ^

@@ -41,7 +41,7 @@ namespace clad {
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ArrayType_Normal' [clang-diagnostic-error]

                                          /*ASM=*/ArrayType_Normal,
                                                  ^

@@ -41,7 +41,7 @@
llvm::APInt(/*numBits=*/32,
str.size() + 1),
/*SizeExpr=*/nullptr,
/*ASM=*/ArrayType::Normal,
/*ASM=*/ArrayType_Normal,
/*IndexTypeQuals*/ 0);
const StringLiteral* SL =
StringLiteral::Create(C, str, /*Kind=*/clad_compat::StringKind_Ordinary,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no member named 'StringKind_Ordinary' in namespace 'clad_compat' [clang-diagnostic-error]

        StringLiteral::Create(C, str, /*Kind=*/clad_compat::StringKind_Ordinary,
                                                            ^

@@ -452,7 +452,7 @@ namespace clad {

// Create elaborated type with namespace specifier,
// i.e. class<T> -> clad::class<T>
return m_Context.getElaboratedType(ETK_None, NS, TT);
return m_Context.getElaboratedType(ElaboratedTypeKeyword_None, NS, TT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'ElaboratedTypeKeyword_None'; did you mean 'clad_compat::ElaboratedTypeKeyword_None'? [clang-diagnostic-error]

Suggested change
return m_Context.getElaboratedType(ElaboratedTypeKeyword_None, NS, TT);
return m_Context.getElaboratedType(clad_compat::ElaboratedTypeKeyword_None, NS, TT);
Additional context

include/clad/Differentiator/Compatibility.h:100: 'clad_compat::ElaboratedTypeKeyword_None' declared here

const auto ElaboratedTypeKeyword_None = ETK_None;
           ^

mcbarton added a commit to mcbarton/clad that referenced this pull request Mar 31, 2024
Co-Authored-By: Vassil Vassilev <v.g.vassilev@gmail.com>
Co-Authored-By: Alexander Penev <7923188+alexander-penev@users.noreply.github.com>
mcbarton added a commit to mcbarton/clad that referenced this pull request Mar 31, 2024
Co-Authored-By: Vassil Vassilev <v.g.vassilev@gmail.com>
Co-Authored-By: Alexander Penev <7923188+alexander-penev@users.noreply.github.com>
mcbarton added a commit to mcbarton/clad that referenced this pull request Mar 31, 2024
Co-Authored-By: Vassil Vassilev <v.g.vassilev@gmail.com>
Co-Authored-By: Alexander Penev <7923188+alexander-penev@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 11. Check the log or trigger a new build to see more.

#if CLANG_VERSION_MAJOR > 17
#define CLAD_COMPAT_CLANG17_ActOnLambdaExpr_getCurrentScope_ExtraParam(V) /**/
#else
#define CLAD_COMPAT_CLANG17_ActOnLambdaExpr_getCurrentScope_ExtraParam(V) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function-like macro 'CLAD_COMPAT_CLANG17_ActOnLambdaExpr_getCurrentScope_ExtraParam' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]

#define CLAD_COMPAT_CLANG17_ActOnLambdaExpr_getCurrentScope_ExtraParam(V)      \
        ^

// FIXME: Knowndependent set to false temporarily until known value found for
// initialisation.

static inline Stmt* UnresolvedLookupExpr_Create(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unused function 'UnresolvedLookupExpr_Create' [clang-diagnostic-unused-function]

static inline Stmt* UnresolvedLookupExpr_Create(
                    ^

// clang 18 clang::ArrayType::ArraySizeModifier became clang::ArraySizeModifier
#if CLANG_VERSION_MAJOR < 18
static inline QualType
getConstantArrayType(const ASTContext& Ctx, QualType EltTy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unused function 'getConstantArrayType' [clang-diagnostic-unused-function]

getConstantArrayType(const ASTContext& Ctx, QualType EltTy,
^

{ \
return CLAD_COMPAT_CREATE(CLASS, CTORARGS); \
}
#define DEFINE_CLONE_STMT_CO(CLASS, CTORARGS) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function-like macro 'DEFINE_CLONE_STMT_CO' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]

#define DEFINE_CLONE_STMT_CO(CLASS, CTORARGS)                                  \
        ^

return CLAD_COMPAT_CREATE(CLASS, CTORARGS); \
}
#define DEFINE_CLONE_STMT_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
(Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \

lib/Differentiator/StmtClone.cpp:30:

-   }
+   })

return CLAD_COMPAT_CREATE(CLASS, CTORARGS); \
}
#define DEFINE_CLONE_STMT_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \

clad_compat::ExprSetDeps(result, Node); \
return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function-like macro 'DEFINE_CLONE_EXPR_CO' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]

#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS)                                  \
        ^

return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
(Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \

lib/Differentiator/StmtClone.cpp:53:

-   }
+   })

return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \

}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
CLASS* result = (CLASS::Create CTORARGS); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
CLASS* result = (CLASS::Create CTORARGS); \
(CLASS)* result = (CLASS::Create CTORARGS); \

@mcbarton
Copy link
Contributor Author

mcbarton commented Mar 31, 2024

@vgvassilev @alexander-penev I have addressed your feedback. This PR is ready for further review

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -419,7 +411,8 @@
return result;
}

DEFINE_CLONE_STMT_CO(ReturnStmt, (CLAD_COMPAT_CLANG8_Ctx_ExtraParams Node->getReturnLoc(), Clone(Node->getRetValue()), 0))
DEFINE_CLONE_STMT_CO(ReturnStmt,
(Ctx, Node->getReturnLoc(), Clone(Node->getRetValue()), 0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use nullptr [modernize-use-nullptr]

Suggested change
(Ctx, Node->getReturnLoc(), Clone(Node->getRetValue()), 0))
(Ctx, Node->getReturnLoc(), Clone(Node->getRetValue()), nullptr))

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#if CLANG_VERSION_MAJOR <= 8
#define CLAD_COMPAT_8_DECLARE_CLONE_FN(ValueStmt) /**/
#elif CLANG_VERSION_MAJOR > 8
#define CLAD_COMPAT_8_DECLARE_CLONE_FN(ValueStmt) DECLARE_CLONE_FN(ValueStmt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function-like macro 'CLAD_COMPAT_8_DECLARE_CLONE_FN' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]

#define CLAD_COMPAT_8_DECLARE_CLONE_FN(ValueStmt) DECLARE_CLONE_FN(ValueStmt)
        ^

return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \
(Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \

lib/Differentiator/StmtClone.cpp:53:

-   }
+   })

@@ -91,8 +88,7 @@
(Ctx, Node->getValue(), CloneType(Node->getType()),
Node->getLocation()))
DEFINE_CLONE_EXPR_CO(PredefinedExpr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: expected ';' after top level declarator [clang-diagnostic-error]

DEFINE_CLONE_EXPR_CO(PredefinedExpr,
^
Additional context

lib/Differentiator/StmtClone.cpp:49: expanded from macro 'DEFINE_CLONE_EXPR_CO'

  Stmt* StmtClone::Visit##CLASS((CLASS)* Node) {                               \
                                               ^

@@ -91,8 +88,7 @@
(Ctx, Node->getValue(), CloneType(Node->getType()),
Node->getLocation()))
DEFINE_CLONE_EXPR_CO(PredefinedExpr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redefinition of 'VisitPredefinedExpr' as different kind of symbol [clang-diagnostic-error]

DEFINE_CLONE_EXPR_CO(PredefinedExpr,
^

expanded from here

@@ -91,8 +88,7 @@
(Ctx, Node->getValue(), CloneType(Node->getType()),
Node->getLocation()))
DEFINE_CLONE_EXPR_CO(PredefinedExpr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use of undeclared identifier 'Node' [clang-diagnostic-error]

DEFINE_CLONE_EXPR_CO(PredefinedExpr,
^
Additional context

lib/Differentiator/StmtClone.cpp:49: expanded from macro 'DEFINE_CLONE_EXPR_CO'

  Stmt* StmtClone::Visit##CLASS((CLASS)* Node) {                               \
                                         ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
(Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \

lib/Differentiator/StmtClone.cpp:53:

-   }
+   })

return result; \
}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
Stmt* StmtClone::Visit##CLASS((CLASS)* Node) { \

}
#define DEFINE_CLONE_EXPR_CO(CLASS, CTORARGS) \
Stmt* StmtClone::Visit##CLASS(CLASS* Node) { \
CLASS* result = (CLASS::Create CTORARGS); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]

Suggested change
CLASS* result = (CLASS::Create CTORARGS); \
(CLASS)* result = (CLASS::Create CTORARGS); \

@vgvassilev
Copy link
Owner

Thank you @mcbarton and @alexander-penev!

@vgvassilev
Copy link
Owner

The codecov and clang-format complaints are bogus.

@vgvassilev vgvassilev merged commit 7b2b713 into vgvassilev:master Apr 1, 2024
86 of 89 checks passed
@mcbarton mcbarton deleted the clang-18 branch April 1, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for clang18
3 participants