Skip to content

Commit

Permalink
rename LLVM to LLVH
Browse files Browse the repository at this point in the history
Summary:
Change the LLVH include path from `llvm/` to `llvh/`, rename the namespace to
`llvh`. This should eliminate any conflicts with the "real" LLVM.

(Note: this ignores all push blocking failures!)

Reviewed By: dulinriley

Differential Revision: D22202846

fbshipit-source-id: bbcabd8439e03e1457939ef5a8dad19f1d1a2f5c
  • Loading branch information
tmikov authored and facebook-github-bot committed Jul 1, 2020
1 parent eca8d2c commit 4f15a2e
Show file tree
Hide file tree
Showing 954 changed files with 8,365 additions and 8,365 deletions.
6 changes: 3 additions & 3 deletions API/hermes/CompileJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "hermes/BCGen/HBC/BytecodeProviderFromSrc.h"
#include "hermes/Support/Algorithms.h"

#include "llvm/Support/SHA1.h"
#include "llvh/Support/SHA1.h"

namespace hermes {

Expand All @@ -32,15 +32,15 @@ bool compileJS(
if (!res.first)
return false;

llvm::raw_string_ostream bcstream(bytecode);
llvh::raw_string_ostream bcstream(bytecode);

BytecodeGenerationOptions opts(::hermes::EmitBundle);
opts.optimizationEnabled = optimize;

hbc::BytecodeSerializer BS{bcstream, opts};
BS.serialize(
*res.first->getBytecodeModule(),
llvm::SHA1::hash(llvm::makeArrayRef(
llvh::SHA1::hash(llvh::makeArrayRef(
reinterpret_cast<const uint8_t *>(str.data()), str.size())));

// Flush to string.
Expand Down
32 changes: 16 additions & 16 deletions API/hermes/SynthTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "hermes/VM/MockedEnvironment.h"
#include "hermes/VM/StringPrimitive.h"

#include "llvm/Support/Endian.h"
#include "llvm/Support/NativeFormatting.h"
#include "llvm/Support/raw_ostream.h"
#include "llvh/Support/Endian.h"
#include "llvh/Support/NativeFormatting.h"
#include "llvh/Support/raw_ostream.h"

#include <cmath>

Expand All @@ -39,8 +39,8 @@ double decodeNumber(const std::string &numberAsString) {
// Assume the original platform and the current platform are both little
// endian for simplicity.
static_assert(
llvm::support::endian::system_endianness() ==
llvm::support::endianness::little,
llvh::support::endian::system_endianness() ==
llvh::support::endianness::little,
"Only little-endian decoding allowed");
assert(
numberAsString.substr(0, 2) == std::string("0x") && "Invalid hex number");
Expand All @@ -57,15 +57,15 @@ std::string doublePrinter(double x) {
// NOTE: While this could use big-endian, it makes it more complicated for
// JS to read out (forces use of a DataView rather than a Float64Array)
static_assert(
llvm::support::endian::system_endianness() ==
llvm::support::endianness::little,
llvh::support::endian::system_endianness() ==
llvh::support::endianness::little,
"Only little-endian encoding allowed");
std::string result;
llvm::raw_string_ostream resultStream{result};
llvm::write_hex(
llvh::raw_string_ostream resultStream{result};
llvh::write_hex(
resultStream,
::hermes::safeTypeCast<double, uint64_t>(x),
llvm::HexPrintStyle::PrefixLower,
llvh::HexPrintStyle::PrefixLower,
16);
resultStream.flush();
return result;
Expand Down Expand Up @@ -95,7 +95,7 @@ bool SynthTrace::TraceValue::operator==(const TraceValue &that) const {
SynthTrace::SynthTrace(
ObjectID globalObjID,
const ::hermes::vm::RuntimeConfig &conf,
std::unique_ptr<llvm::raw_ostream> traceStream)
std::unique_ptr<llvh::raw_ostream> traceStream)
: traceStream_(std::move(traceStream)), globalObjID_(globalObjID) {
if (traceStream_) {
json_ = std::make_unique<JSONEmitter>(*traceStream_, /*pretty*/ true);
Expand Down Expand Up @@ -475,7 +475,7 @@ bool SynthTrace::GetNativePropertyNamesReturnRecord::operator==(

void SynthTrace::Record::toJSONInternal(JSONEmitter &json) const {
std::string storage;
llvm::raw_string_ostream os{storage};
llvh::raw_string_ostream os{storage};
os << getType() << "Record";
os.flush();

Expand All @@ -501,15 +501,15 @@ void SynthTrace::CreateStringRecord::toJSONInternal(JSONEmitter &json) const {
Record::toJSONInternal(json);
json.emitKeyValue("objID", objID_);
json.emitKeyValue("encoding", encodingName(ascii_));
json.emitKeyValue("chars", llvm::StringRef(chars_.data(), chars_.size()));
json.emitKeyValue("chars", llvh::StringRef(chars_.data(), chars_.size()));
}

void SynthTrace::CreatePropNameIDRecord::toJSONInternal(
JSONEmitter &json) const {
Record::toJSONInternal(json);
json.emitKeyValue("objID", propNameID_);
json.emitKeyValue("encoding", encodingName(ascii_));
json.emitKeyValue("chars", llvm::StringRef(chars_.data(), chars_.size()));
json.emitKeyValue("chars", llvh::StringRef(chars_.data(), chars_.size()));
}

void SynthTrace::CreateHostFunctionRecord::toJSONInternal(
Expand Down Expand Up @@ -755,8 +755,8 @@ void SynthTrace::flushAndDisable(
traceStream_.reset();
}

llvm::raw_ostream &operator<<(
llvm::raw_ostream &os,
llvh::raw_ostream &operator<<(
llvh::raw_ostream &os,
SynthTrace::RecordType type) {
#define CASE(t) \
case SynthTrace::RecordType::t: \
Expand Down
16 changes: 8 additions & 8 deletions API/hermes/SynthTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
#include <string>
#include <vector>

namespace llvm {
namespace llvh {
// Forward declaration to avoid including llvm headers.
class raw_ostream;
} // namespace llvm
} // namespace llvh

namespace facebook {
namespace hermes {
namespace tracing {

/// A SynthTrace is a list of events that occur in a run of a JS file by a
/// runtime that uses JSI.
/// It can be serialized into JSON and written to a llvm::raw_ostream.
/// It can be serialized into JSON and written to a llvh::raw_ostream.
class SynthTrace {
public:
using ObjectID = uint64_t;
Expand Down Expand Up @@ -256,7 +256,7 @@ class SynthTrace {
explicit SynthTrace(
ObjectID globalObjID,
const ::hermes::vm::RuntimeConfig &conf,
std::unique_ptr<llvm::raw_ostream> traceStream = nullptr);
std::unique_ptr<llvh::raw_ostream> traceStream = nullptr);

template <typename T, typename... Args>
void emplace_back(Args &&... args) {
Expand Down Expand Up @@ -301,7 +301,7 @@ class SynthTrace {
static ::hermes::vm::ReleaseUnused releaseUnusedFromName(const char *name);

private:
llvm::raw_ostream &os() const {
llvh::raw_ostream &os() const {
return (*traceStream_);
}

Expand All @@ -319,7 +319,7 @@ class SynthTrace {

/// If we're tracing to a file, pointer to a stream onto
/// traceFilename_. Null otherwise.
std::unique_ptr<llvm::raw_ostream> traceStream_;
std::unique_ptr<llvh::raw_ostream> traceStream_;
/// If we're tracing to a file, pointer to a JSONEmitter writting
/// into *traceStream_. Null otherwise.
std::unique_ptr<::hermes::JSONEmitter> json_;
Expand Down Expand Up @@ -1079,8 +1079,8 @@ class SynthTrace {
const ::hermes::vm::GCExecTrace &gcTrace);
};

llvm::raw_ostream &operator<<(
llvm::raw_ostream &os,
llvh::raw_ostream &operator<<(
llvh::raw_ostream &os,
SynthTrace::RecordType type);
std::istream &operator>>(std::istream &is, SynthTrace::RecordType &type);

Expand Down
Loading

0 comments on commit 4f15a2e

Please sign in to comment.