mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Modify LTOModule::isTargetMatch to take a StringRef instead of a MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59349ad8ad
commit
5c58257d39
@ -202,8 +202,8 @@ private:
|
|||||||
/// Get string that the data pointer points to.
|
/// Get string that the data pointer points to.
|
||||||
bool objcClassNameFromExpression(const Constant *c, std::string &name);
|
bool objcClassNameFromExpression(const Constant *c, std::string &name);
|
||||||
|
|
||||||
/// Returns 'true' if the memory buffer is for the specified target triple.
|
/// Returns 'true' if the bitcode BC is for the specified target triple.
|
||||||
static bool isTargetMatch(MemoryBuffer *memBuffer, const char *triplePrefix);
|
static bool isTargetMatch(StringRef BC, const char *TriplePrefix);
|
||||||
|
|
||||||
/// Create an LTOModule (private version). N.B. This method takes ownership of
|
/// Create an LTOModule (private version). N.B. This method takes ownership of
|
||||||
/// the buffer.
|
/// the buffer.
|
||||||
|
@ -75,7 +75,7 @@ bool LTOModule::isBitcodeFileForTarget(const void *mem, size_t length,
|
|||||||
MemoryBuffer *buffer = makeBuffer(mem, length);
|
MemoryBuffer *buffer = makeBuffer(mem, length);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return false;
|
return false;
|
||||||
return isTargetMatch(buffer, triplePrefix);
|
return isTargetMatch(StringRef((const char *)mem, length), triplePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LTOModule::isBitcodeFileForTarget(const char *path,
|
bool LTOModule::isBitcodeFileForTarget(const char *path,
|
||||||
@ -83,15 +83,15 @@ bool LTOModule::isBitcodeFileForTarget(const char *path,
|
|||||||
std::unique_ptr<MemoryBuffer> buffer;
|
std::unique_ptr<MemoryBuffer> buffer;
|
||||||
if (MemoryBuffer::getFile(path, buffer))
|
if (MemoryBuffer::getFile(path, buffer))
|
||||||
return false;
|
return false;
|
||||||
return isTargetMatch(buffer.release(), triplePrefix);
|
return isTargetMatch(buffer->getBuffer(), triplePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isTargetMatch - Returns 'true' if the memory buffer is for the specified
|
/// Returns 'true' if the bitcode BC is for the specified target triple.
|
||||||
/// target triple.
|
bool LTOModule::isTargetMatch(StringRef BC, const char *TriplePrefix) {
|
||||||
bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
|
std::unique_ptr<MemoryBuffer> Buffer(
|
||||||
std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
|
MemoryBuffer::getMemBuffer(BC, "", false));
|
||||||
delete buffer;
|
std::string Triple = getBitcodeTargetTriple(Buffer.get(), getGlobalContext());
|
||||||
return strncmp(Triple.c_str(), triplePrefix, strlen(triplePrefix)) == 0;
|
return strncmp(Triple.c_str(), TriplePrefix, strlen(TriplePrefix)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LTOModule *LTOModule::createFromFile(const char *path, TargetOptions options,
|
LTOModule *LTOModule::createFromFile(const char *path, TargetOptions options,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user