Skip to content

Add several interfaces for Clang AST nodes. - #661

Merged
lkorenc merged 12 commits into
masterfrom
clang-cfg-interfaces
Jul 17, 2024
Merged

lkorenc merged 12 commits into
masterfrom
clang-cfg-interfaces

Conversation

@anthro-poid

Copy link
Copy Markdown
Contributor

No description provided.

@anthro-poid
anthro-poid requested a review from lkorenc July 10, 2024 09:34
@anthro-poid
anthro-poid marked this pull request as ready for review July 10, 2024 10:21
@anthro-poid
anthro-poid requested a review from xlauko as a code owner July 10, 2024 10:21
Comment thread tools/vast-repl/command.cpp Outdated
Comment thread lib/vast/Interfaces/CMakeLists.txt Outdated
@anthro-poid
anthro-poid force-pushed the clang-cfg-interfaces branch 4 times, most recently from 80b715f to 7152209 Compare July 10, 2024 15:44

@xlauko xlauko left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@lkorenc @anthro-poid lets open a discussion about naming.

I suggest to simplify it a bit:

  • rename folder to Interfaces/AST/
  • drop AST prefix from file names
  • put interfaces into vast::ast namespace. I know too much ast, but this should not be part of vast namespace. To do this see bellow.
  • also we need to rename interface definitions in tablegen to have some unique prefix, otherwise we clash if we link against clangir. Make it def VAST_DeclInterface.

Create common Interfaces in Interfaces/AST/Common.td:

// Copyright (c) 2024, Trail of Bits, Inc.

#ifndef VAST_AST_INTERFACES_COMMON
#define VAST_AST_INTERFACES_COMMON

include "mlir/IR/OpBase.td"

class VAST_ASTOpInterface<string name, list<Interface> baseInterfaces = []>
    : OpInterface<name, baseInterfaces>
{
    let cppNamespace = "::vast::ast";
}

class VAST_ASTTypeInterface<string name, list<Interface> baseInterfaces = []>
    : TypeInterface<name, baseInterfaces>
{
    let cppNamespace = "::vast::ast";
}

class VAST_ASTAttrInterface<string name, list<Interface> baseInterfaces = []>
    : AttrInterface<name, baseInterfaces>
{
    let cppNamespace = "::vast::ast";
}

#endif // VAST_AST_INTERFACES_COMMON

Comment thread include/vast/Interfaces/ClangAST/ASTDeclInterface.td Outdated
Comment thread include/vast/Interfaces/ClangAST/ASTDeclInterface.td Outdated
Comment thread include/vast/Interfaces/ClangAST/ASTDeclInterface.td Outdated
Comment thread include/vast/Interfaces/ClangAST/ASTDeclInterface.td Outdated
Comment thread lib/vast/Interfaces/ClangAST/ASTStmtVisitorInterface.cpp
Comment thread include/vast/repl/command.hpp
@anthro-poid
anthro-poid force-pushed the clang-cfg-interfaces branch 2 times, most recently from 4950147 to 84e4b66 Compare July 11, 2024 14:41
Comment thread include/vast/Interfaces/AST/DeclInterface.td Outdated
@anthro-poid
anthro-poid force-pushed the clang-cfg-interfaces branch from fe97788 to 0dddd82 Compare July 17, 2024 11:31
@github-actions

Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format reports: 6 file(s) not formatted
  • include/vast/Interfaces/AST/ContextInterface.hpp
  • include/vast/Interfaces/AST/DeclInterface.hpp
  • include/vast/Interfaces/AST/ExprInterface.hpp
  • include/vast/Interfaces/AST/TypeInterface.hpp
  • lib/vast/Dialect/HighLevel/HighLevelOps.cpp
  • lib/vast/Interfaces/AST/ContextInterface.cpp
clang-tidy reports: 4 concern(s)
  • include/vast/Interfaces/AST/ContextInterface.hpp:16:10: error: [clang-diagnostic-error]

    'vast/Interfaces/AST/ContextInterface.h.inc' file not found

       16 | #include "vast/Interfaces/AST/ContextInterface.h.inc"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • include/vast/Interfaces/AST/DeclInterface.hpp:16:10: error: [clang-diagnostic-error]

    'vast/Interfaces/AST/DeclInterface.h.inc' file not found

       16 | #include "vast/Interfaces/AST/DeclInterface.h.inc"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • include/vast/Interfaces/AST/ExprInterface.hpp:16:10: error: [clang-diagnostic-error]

    'vast/Interfaces/AST/ExprInterface.h.inc' file not found

       16 | #include "vast/Interfaces/AST/ExprInterface.h.inc"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • include/vast/Interfaces/AST/TypeInterface.hpp:16:10: error: [clang-diagnostic-error]

    'vast/Interfaces/AST/TypeInterface.h.inc' file not found

       16 | #include "vast/Interfaces/AST/TypeInterface.h.inc"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Have any feedback or feature suggestions? Share it here.

@lkorenc
lkorenc merged commit 7754376 into master Jul 17, 2024
@lkorenc
lkorenc deleted the clang-cfg-interfaces branch July 17, 2024 11:48
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.

3 participants