diff --git a/clang/unittests/CodeGen/IRMatchers.h b/clang/unittests/CodeGen/IRMatchers.h index 9cc2a317772e..25bd1d5aa956 100644 --- a/clang/unittests/CodeGen/IRMatchers.h +++ b/clang/unittests/CodeGen/IRMatchers.h @@ -356,7 +356,7 @@ public: // Helper function used to construct matchers. -std::shared_ptr MSameAs(unsigned N) { +inline std::shared_ptr MSameAs(unsigned N) { return std::shared_ptr(new SameAsMatcher(N)); } @@ -367,36 +367,35 @@ std::shared_ptr MInstruction(unsigned C, T... Args) { return std::shared_ptr(Result); } -std::shared_ptr MConstInt(uint64_t V, unsigned W = 0) { +inline std::shared_ptr MConstInt(uint64_t V, unsigned W = 0) { return std::shared_ptr(new ConstantIntMatcher(V, W)); } -std::shared_ptr> - MValType(std::shared_ptr> T) { +inline std::shared_ptr> +MValType(std::shared_ptr> T) { return std::shared_ptr>(new ValueTypeMatcher(T)); } -std::shared_ptr> MValType(const Type *T) { +inline std::shared_ptr> MValType(const Type *T) { return std::shared_ptr>(new ValueTypeMatcher(T)); } -std::shared_ptr> +inline std::shared_ptr> MType(std::function C) { return std::shared_ptr>(new CondMatcher(C)); } -std::shared_ptr> MMAny() { +inline std::shared_ptr> MMAny() { return std::shared_ptr>(new AnyMatcher); } -std::shared_ptr> +inline std::shared_ptr> MMSave(const Metadata *&V, std::shared_ptr> M) { return std::shared_ptr>( new SavingMatcher(V, M)); } -std::shared_ptr> -MMString(const char *Name) { +inline std::shared_ptr> MMString(const char *Name) { return std::shared_ptr>(new NameMetaMatcher(Name)); } @@ -413,7 +412,8 @@ std::shared_ptr> MMTuple(T... Args) { /// \returns Pointer to the found instruction or nullptr if such instruction /// was not found. /// -const Instruction *match(const BasicBlock *BB, std::shared_ptr M) { +inline const Instruction *match(const BasicBlock *BB, + std::shared_ptr M) { MatcherContext MC; for (const auto &I : *BB) { MC.push(&I); @@ -425,13 +425,12 @@ const Instruction *match(const BasicBlock *BB, std::shared_ptr M) { return nullptr; } - /// Looks for the instruction that satisfies condition of the specified /// matcher starting from the specified instruction inside the same basic block. /// /// The given instruction is not checked. /// -const Instruction *matchNext(const Instruction *I, std::shared_ptr M) { +inline const Instruction *matchNext(const Instruction *I, std::shared_ptr M) { if (!I) return nullptr; MatcherContext MC;