diff --git a/ets2panda/checker/types/ets/etsEnumType.h b/ets2panda/checker/types/ets/etsEnumType.h index 26ac87f16d53f2e15212451c8a1f3195530a4c7c..2bd8c99d3e2bc35d51ff9ace55572753de6a8cdb 100644 --- a/ets2panda/checker/types/ets/etsEnumType.h +++ b/ets2panda/checker/types/ets/etsEnumType.h @@ -80,9 +80,9 @@ public: [[nodiscard]] bool IsLiteralType() const noexcept; - [[nodiscard]] bool IsSameEnumType(const ETSEnumInterface *other) const noexcept; + [[nodiscard]] bool IsSameEnumType(const ETSEnumInterface *const other) const noexcept; - [[nodiscard]] bool IsSameEnumLiteralType(const ETSEnumInterface *other) const noexcept; + [[nodiscard]] bool IsSameEnumLiteralType(const ETSEnumInterface *const other) const noexcept; [[nodiscard]] bool IsEnumInstanceExpression(const ir::Expression *expression) const noexcept; diff --git a/ets2panda/checker/types/typeRelation.h b/ets2panda/checker/types/typeRelation.h index fa82ecd646116fda2881fedec9a27bf63e947b60..50a2403bbd56632ef471bcbe4328736c17dc6b57 100644 --- a/ets2panda/checker/types/typeRelation.h +++ b/ets2panda/checker/types/typeRelation.h @@ -264,7 +264,7 @@ public: bool IsIdenticalTo(IndexInfo *source, IndexInfo *target); bool IsAssignableTo(Type *source, Type *target); bool IsComparableTo(Type *source, Type *target); - bool IsCastableTo(Type *source, Type *target); + bool IsCastableTo(Type *const source, Type *const target); bool IsSupertypeOf(Type *super, Type *sub); void RaiseError(const std::string &errMsg, const lexer::SourcePosition &loc) const; void RaiseError(std::initializer_list list, const lexer::SourcePosition &loc) const; diff --git a/ets2panda/compiler/base/lreference.h b/ets2panda/compiler/base/lreference.h index 8a21460f6d0a892cef8c1ef8292a4271860b7a8c..35dc5c4edde74c8bf5f863b4d8d2a734c0a36473 100644 --- a/ets2panda/compiler/base/lreference.h +++ b/ets2panda/compiler/base/lreference.h @@ -140,7 +140,7 @@ public: void GetValue() const; void SetValue() const; - static ETSLReference Create(CodeGen *cg, const ir::AstNode *node, bool isDeclaration); + static ETSLReference Create(CodeGen *const cg, const ir::AstNode *const node, const bool isDeclaration); static ReferenceKind ResolveReferenceKind(const varbinder::Variable *variable); private: diff --git a/ets2panda/compiler/core/ETSGen.cpp b/ets2panda/compiler/core/ETSGen.cpp index c659e488843d5e65258901d5d8f233d0cd5557df..1949eabc5105e22b080ea15b364fbca0706cd0e5 100644 --- a/ets2panda/compiler/core/ETSGen.cpp +++ b/ets2panda/compiler/core/ETSGen.cpp @@ -644,10 +644,10 @@ void ETSGen::CreateLambdaObjectFromMemberReference(const ir::AstNode *node, ir:: } // NOLINTBEGIN(cppcoreguidelines-macro-usage, readability-container-size-empty) -#define CONV_LAMBDA_CTOR_ARG(idx) \ - ASSERT(idx < arguments.size()); \ - auto *paramType##idx = signature->Params()[idx]->TsType(); \ - auto ttctx##idx = TargetTypeContext(this, paramType##idx); \ +#define CONV_LAMBDA_CTOR_ARG(idx) \ + ASSERT((idx) < arguments.size()); \ + auto *paramType##idx = signature->Params()[(idx)]->TsType(); \ + auto ttctx##idx = TargetTypeContext(this, paramType##idx); \ ApplyConversion(node, paramType##idx) void ETSGen::InitLambdaObject(const ir::AstNode *node, checker::Signature *signature, std::vector &arguments) diff --git a/ets2panda/compiler/core/regAllocator.h b/ets2panda/compiler/core/regAllocator.h index f248c365972d4dbfe9ba20aa23f4169c0c7928aa..287226291c428b229a2a803e3a22b88913122215 100644 --- a/ets2panda/compiler/core/regAllocator.h +++ b/ets2panda/compiler/core/regAllocator.h @@ -29,7 +29,7 @@ class CodeGen; class AllocatorBase { public: - explicit AllocatorBase(CodeGen *cg) noexcept; + explicit AllocatorBase(CodeGen *const cg) noexcept; NO_COPY_SEMANTIC(AllocatorBase); NO_MOVE_SEMANTIC(AllocatorBase); ~AllocatorBase() = default; @@ -60,7 +60,7 @@ private: class SimpleAllocator final : public AllocatorBase { public: - explicit SimpleAllocator(CodeGen *cg) noexcept; + explicit SimpleAllocator(CodeGen *const cg) noexcept; NO_COPY_SEMANTIC(SimpleAllocator); NO_MOVE_SEMANTIC(SimpleAllocator); ~SimpleAllocator() = default; diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index 89490be064ec86c3e5325c427ccc3f8088862aca..ca5fefcf6dd60b559a9ea6ce69c2d83dc8834f40 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -193,9 +193,9 @@ private: ir::TypeNode *ParseFunctionType(); ir::TypeNode *ParseETSTupleType(TypeAnnotationParsingOptions *options); std::pair CheckDefaultParameters(const ir::ScriptFunction *function) const; - ir::MethodDefinition *CreateProxyMethodDefinition(ir::MethodDefinition const *method, - ir::Identifier const *identNode); - ir::MethodDefinition *CreateProxyConstructorDefinition(ir::MethodDefinition const *method); + ir::MethodDefinition *CreateProxyMethodDefinition(ir::MethodDefinition const *const method, + ir::Identifier const *const identNode); + ir::MethodDefinition *CreateProxyConstructorDefinition(ir::MethodDefinition const *const method); void AddProxyOverloadToMethodWithDefaultParams(ir::MethodDefinition *method, ir::Identifier *identNode = nullptr); static std::string PrimitiveTypeToName(ir::PrimitiveType type); std::string GetNameForTypeNode(const ir::TypeNode *typeAnnotation, bool adjust = true) const; @@ -330,7 +330,7 @@ private: ir::Expression *ParsePotentialExpressionSequence(ir::Expression *expr, ExpressionParseFlags flags) override; - ir::ModifierFlags ParseTypeVarianceModifier(TypeAnnotationParsingOptions *options); + ir::ModifierFlags ParseTypeVarianceModifier(TypeAnnotationParsingOptions *const options); ir::ScriptFunction *AddInitMethod(ArenaVector &globalProperties); ir::Statement *ParseTopLevelStatement(StatementParsingFlags flags = StatementParsingFlags::NONE); diff --git a/ets2panda/util/arktsconfig.cpp b/ets2panda/util/arktsconfig.cpp index 0cde0b5691fbd06daf2c6b159b95abbd6a995aa9..3e84f1fd0545b7bfdfb1bc667d2f65fa65aa2d8d 100644 --- a/ets2panda/util/arktsconfig.cpp +++ b/ets2panda/util/arktsconfig.cpp @@ -41,7 +41,7 @@ namespace fs = std::experimental::filesystem; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define CHECK(cond, ret, msg) \ - if (!cond) { \ + if (!(cond)) { \ std::cerr << "ArkTsConfig error: " << msg << std::endl; \ return ret; \ } diff --git a/ets2panda/util/generateBin.h b/ets2panda/util/generateBin.h index a5a3456724538fd89506cb0f612d1fb786cbf312..68977de892f70858cfed98b7e41139909e4af519 100644 --- a/ets2panda/util/generateBin.h +++ b/ets2panda/util/generateBin.h @@ -13,12 +13,12 @@ * limitations under the License. */ +#ifndef ES2PANDA_UTIL_GENERATEBIN_H +#define ES2PANDA_UTIL_GENERATEBIN_H + #include "parser/program/program.h" #include "util/options.h" -#ifndef ES2PANDA_UTIL_GENERATE_BIN_H -#define ES2PANDA_UTIL_GENREATE_BIN_H - namespace panda::es2panda::util { using ReporterFun = std::function; @@ -27,4 +27,4 @@ int GenerateProgram(panda::pandasm::Program *prog, const util::Options *options, } // namespace panda::es2panda::util -#endif +#endif // ES2PANDA_UTIL_GENERATEBIN_H diff --git a/ets2panda/util/helpers.h b/ets2panda/util/helpers.h index 6b8a9d030c868d4f03ca0f39551d29910a0acea1..f3f0b927def1331db906a85bd257f636bced776b 100644 --- a/ets2panda/util/helpers.h +++ b/ets2panda/util/helpers.h @@ -142,7 +142,7 @@ public: static const uint32_t INVALID_INDEX = 4294967295L; static std::string CreateEscapedString(const std::string &str); - static std::string UTF16toUTF8(char16_t c); + static std::string UTF16toUTF8(const char16_t c); template static void LogDebug(Elements &&...elems); diff --git a/ets2panda/util/language.h b/ets2panda/util/language.h index 3d4b2241774bbfbf6a45bac64229864e8b02279e..631d1e1722aff3cd8fdccf553ec5ad50cf3e2b2e 100644 --- a/ets2panda/util/language.h +++ b/ets2panda/util/language.h @@ -48,7 +48,7 @@ public: // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TO_STR(e, s, d) \ if (id_ == Id::e) { \ - return s; \ + return (s); \ } LANGUAGES(TO_STR) #undef TO_STR @@ -59,7 +59,7 @@ public: { // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define FROM_STR(e, s, d) \ - if (str == s) { \ + if (str == (s)) { \ return Language(Id::e); \ } LANGUAGES(FROM_STR) @@ -77,7 +77,7 @@ public: // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TO_DYN(e, s, d) \ if (id_ == Id::e) { \ - return d; \ + return (d); \ } LANGUAGES(TO_DYN) #undef TO_DYN diff --git a/ets2panda/varbinder/recordTable.h b/ets2panda/varbinder/recordTable.h index d3281653b397d8cd5e9c7479b20f340db99796e5..7dd5e555e2aa9d8aaf1522a40442ec237c73291e 100644 --- a/ets2panda/varbinder/recordTable.h +++ b/ets2panda/varbinder/recordTable.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ES2PANDA_recordTable_RECORD_TABLE_H -#define ES2PANDA_recordTable_RECORD_TABLE_H +#ifndef ES2PANDA_VARBINDER_RECORDTABLE_H +#define ES2PANDA_VARBINDER_RECORDTABLE_H #include "macros.h" #include "utils/arena_containers.h" @@ -186,4 +186,4 @@ private: } // namespace panda::es2panda::varbinder -#endif +#endif // ES2PANDA_VARBINDER_RECORDTABLE_H