r370383 - Added 'inline' to functions defined in headers to avoid ODR violations
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 09:58:13 PDT 2019
Author: gribozavr
Date: Thu Aug 29 09:58:13 2019
New Revision: 370383
URL: http://llvm.org/viewvc/llvm-project?rev=370383&view=rev
Log:
Added 'inline' to functions defined in headers to avoid ODR violations
Modified:
cfe/trunk/unittests/CodeGen/IRMatchers.h
Modified: cfe/trunk/unittests/CodeGen/IRMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/CodeGen/IRMatchers.h?rev=370383&r1=370382&r2=370383&view=diff
==============================================================================
--- cfe/trunk/unittests/CodeGen/IRMatchers.h (original)
+++ cfe/trunk/unittests/CodeGen/IRMatchers.h Thu Aug 29 09:58:13 2019
@@ -356,7 +356,7 @@ public:
// Helper function used to construct matchers.
-std::shared_ptr<Matcher> MSameAs(unsigned N) {
+inline std::shared_ptr<Matcher> MSameAs(unsigned N) {
return std::shared_ptr<Matcher>(new SameAsMatcher(N));
}
@@ -367,36 +367,35 @@ std::shared_ptr<InstructionMatcher> MIns
return std::shared_ptr<InstructionMatcher>(Result);
}
-std::shared_ptr<Matcher> MConstInt(uint64_t V, unsigned W = 0) {
+inline std::shared_ptr<Matcher> MConstInt(uint64_t V, unsigned W = 0) {
return std::shared_ptr<Matcher>(new ConstantIntMatcher(V, W));
}
-std::shared_ptr<EntityMatcher<Value>>
- MValType(std::shared_ptr<EntityMatcher<Type>> T) {
+inline std::shared_ptr<EntityMatcher<Value>>
+MValType(std::shared_ptr<EntityMatcher<Type>> T) {
return std::shared_ptr<EntityMatcher<Value>>(new ValueTypeMatcher(T));
}
-std::shared_ptr<EntityMatcher<Value>> MValType(const Type *T) {
+inline std::shared_ptr<EntityMatcher<Value>> MValType(const Type *T) {
return std::shared_ptr<EntityMatcher<Value>>(new ValueTypeMatcher(T));
}
-std::shared_ptr<EntityMatcher<Type>>
+inline std::shared_ptr<EntityMatcher<Type>>
MType(std::function<bool(const Type &)> C) {
return std::shared_ptr<EntityMatcher<Type>>(new CondMatcher<Type>(C));
}
-std::shared_ptr<EntityMatcher<Metadata>> MMAny() {
+inline std::shared_ptr<EntityMatcher<Metadata>> MMAny() {
return std::shared_ptr<EntityMatcher<Metadata>>(new AnyMatcher<Metadata>);
}
-std::shared_ptr<EntityMatcher<Metadata>>
+inline std::shared_ptr<EntityMatcher<Metadata>>
MMSave(const Metadata *&V, std::shared_ptr<EntityMatcher<Metadata>> M) {
return std::shared_ptr<EntityMatcher<Metadata>>(
new SavingMatcher<Metadata>(V, M));
}
-std::shared_ptr<EntityMatcher<Metadata>>
-MMString(const char *Name) {
+inline std::shared_ptr<EntityMatcher<Metadata>> MMString(const char *Name) {
return std::shared_ptr<EntityMatcher<Metadata>>(new NameMetaMatcher(Name));
}
@@ -413,7 +412,8 @@ std::shared_ptr<EntityMatcher<Metadata>>
/// \returns Pointer to the found instruction or nullptr if such instruction
/// was not found.
///
-const Instruction *match(const BasicBlock *BB, std::shared_ptr<Matcher> M) {
+inline const Instruction *match(const BasicBlock *BB,
+ std::shared_ptr<Matcher> M) {
MatcherContext MC;
for (const auto &I : *BB) {
MC.push(&I);
@@ -425,13 +425,12 @@ const Instruction *match(const BasicBloc
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<Matcher> M) {
+inline const Instruction *matchNext(const Instruction *I, std::shared_ptr<Matcher> M) {
if (!I)
return nullptr;
MatcherContext MC;
More information about the cfe-commits
mailing list