-
Notifications
You must be signed in to change notification settings - Fork 26
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
Hide header files that are not part of the interface. #158
Conversation
e8709ac
to
b9b0a09
Compare
Header files that are only used in the implementation files can become local to the library. This would simplify the installation.
b9b0a09
to
cd20749
Compare
Codecov Report
@@ Coverage Diff @@
## main #158 +/- ##
==========================================
- Coverage 57.26% 57.21% -0.05%
==========================================
Files 8 8
Lines 2878 2877 -1
==========================================
- Hits 1648 1646 -2
- Misses 1230 1231 +1
|
There was a problem hiding this 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 29. Check the log or trigger a new build to see more.
#include "clang/AST/Mangle.h" | ||
#include "clang/Frontend/CompilerInstance.h" | ||
#include "clang/Interpreter/Interpreter.h" | ||
#include "clang/Interpreter/Value.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'clang/Interpreter/Value.h' file not found [clang-diagnostic-error]
#include "clang/Interpreter/Value.h"
^
#ifndef CPPINTEROP_COMPATIBILITY_H | ||
#define CPPINTEROP_COMPATIBILITY_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: header guard does not follow preferred style [llvm-header-guard]
#ifndef CPPINTEROP_COMPATIBILITY_H | |
#define CPPINTEROP_COMPATIBILITY_H | |
#ifndef GITHUB_WORKSPACE_LIB_INTERPRETER_COMPATIBILITY_H | |
#define GITHUB_WORKSPACE_LIB_INTERPRETER_COMPATIBILITY_H |
lib/Interpreter/Compatibility.h:310:
- #endif // CPPINTEROP_COMPATIBILITY_H
+ #endif // GITHUB_WORKSPACE_LIB_INTERPRETER_COMPATIBILITY_H
#include "clang/AST/Mangle.h" | ||
#include "clang/Frontend/CompilerInstance.h" | ||
#include "clang/Interpreter/Interpreter.h" | ||
#include "clang/Interpreter/Value.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'clang/Interpreter/Value.h' file not found [clang-diagnostic-error]
#include "clang/Interpreter/Value.h"
^
return Arg == match; | ||
}; | ||
auto it = std::find_if(args.begin(), args.end(), has_arg); | ||
std::vector<const char*> gpu_args = {it, args.end()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'gpu_args' is not initialized [cppcoreguidelines-init-variables]
std::vector<const char*> gpu_args = {it, args.end()}; | |
std::vector<const char*> gpu_args = 0 = {it, args.end()}; |
clang::IncrementalCompilerBuilder CB; | ||
CB.SetCompilerArgs({args.begin(), it}); | ||
|
||
std::unique_ptr<clang::CompilerInstance> DeviceCI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'DeviceCI' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<clang::CompilerInstance> DeviceCI; | |
std::unique_ptr<clang::CompilerInstance> DeviceCI = 0; |
// copied and adapted from CodeGen::CodeGenModule::getMangledName | ||
|
||
clang::NamedDecl* D = | ||
llvm::cast<clang::NamedDecl>(const_cast<clang::Decl*>(GD.getDecl())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast]
llvm::cast<clang::NamedDecl>(const_cast<clang::Decl*>(GD.getDecl()));
^
|
||
clang::NamedDecl* D = | ||
llvm::cast<clang::NamedDecl>(const_cast<clang::Decl*>(GD.getDecl())); | ||
std::unique_ptr<clang::MangleContext> mangleCtx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'mangleCtx' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<clang::MangleContext> mangleCtx; | |
std::unique_ptr<clang::MangleContext> mangleCtx = 0; |
inline llvm::orc::LLJIT* getExecutionEngine(clang::Interpreter& I) { | ||
#if CLANG_VERSION_MAJOR >= 14 | ||
auto* engine = &llvm::cantFail(I.getExecutionEngine()); | ||
return const_cast<llvm::orc::LLJIT*>(engine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast]
return const_cast<llvm::orc::LLJIT*>(engine);
^
namespace Cpp_utils = Cpp::utils; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: namespace alias decl 'Cpp_utils' is unused [misc-unused-alias-decls]
namespace Cpp_utils = Cpp::utils; | |
} | |
} |
|
||
// Clang >= 14 change type name to string (spaces formatting problem) | ||
#if CLANG_VERSION_MAJOR >= 14 | ||
inline std::string FixTypeName(const std::string type_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the const qualified parameter 'type_name' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
inline std::string FixTypeName(const std::string type_name) { | |
inline std::string FixTypeName(const std::string& type_name) { |
Header files that are only used in the implementation files can become local to the library. This would simplify the installation.