mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00
Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
77696bebbc
commit
27dba671c3
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include <string>
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -227,9 +227,7 @@ public:
|
|||||||
void AddInteger(long long I);
|
void AddInteger(long long I);
|
||||||
void AddInteger(unsigned long long I);
|
void AddInteger(unsigned long long I);
|
||||||
void AddBoolean(bool B) { AddInteger(B ? 1U : 0U); }
|
void AddBoolean(bool B) { AddInteger(B ? 1U : 0U); }
|
||||||
void AddString(const char* String, const char* End);
|
void AddString(StringRef String);
|
||||||
void AddString(const std::string &String);
|
|
||||||
void AddString(const char* String);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }
|
inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }
|
||||||
|
@ -63,14 +63,14 @@ void FoldingSetNodeID::AddInteger(unsigned long long I) {
|
|||||||
Bits.push_back(unsigned(I >> 32));
|
Bits.push_back(unsigned(I >> 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FoldingSetNodeID::AddString(const char *String, const char *End) {
|
void FoldingSetNodeID::AddString(StringRef String) {
|
||||||
unsigned Size = static_cast<unsigned>(End - String);
|
unsigned Size = String.size();
|
||||||
Bits.push_back(Size);
|
Bits.push_back(Size);
|
||||||
if (!Size) return;
|
if (!Size) return;
|
||||||
|
|
||||||
unsigned Units = Size / 4;
|
unsigned Units = Size / 4;
|
||||||
unsigned Pos = 0;
|
unsigned Pos = 0;
|
||||||
const unsigned *Base = (const unsigned *)String;
|
const unsigned *Base = (const unsigned*) String.data();
|
||||||
|
|
||||||
// If the string is aligned do a bulk transfer.
|
// If the string is aligned do a bulk transfer.
|
||||||
if (!((intptr_t)Base & 3)) {
|
if (!((intptr_t)Base & 3)) {
|
||||||
@ -100,14 +100,6 @@ void FoldingSetNodeID::AddString(const char *String, const char *End) {
|
|||||||
Bits.push_back(V);
|
Bits.push_back(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FoldingSetNodeID::AddString(const char *String) {
|
|
||||||
AddString(String, String + strlen(String));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FoldingSetNodeID::AddString(const std::string &String) {
|
|
||||||
AddString(&*String.begin(), &*String.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to
|
/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to
|
||||||
/// lookup the node in the FoldingSetImpl.
|
/// lookup the node in the FoldingSetImpl.
|
||||||
unsigned FoldingSetNodeID::ComputeHash() const {
|
unsigned FoldingSetNodeID::ComputeHash() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user