Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Remove using namespace std
Browse files Browse the repository at this point in the history
Summary:
Compiler.h seems to be one of the only files in the codebase that have
the line `using namespace std;`. This has led to the namespace
specifier being inconsistently used in Compiler.h and in files that
include it.

Reviewed By: avp

Differential Revision: D22035154

fbshipit-source-id: d3b4b544be6249f41b434789fa667a2cd266d07c
  • Loading branch information
neildhar authored and facebook-github-bot committed Jun 15, 2020
1 parent db57e8c commit 603a132
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions include/hermes/Regex/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
namespace hermes {
namespace regex {

using namespace std;

namespace constants {

// MatchFlagType
Expand Down Expand Up @@ -493,7 +491,7 @@ class LoopNode final : public Node {
mexpBegin_(mexpBegin),
mexpEnd_(mexpEnd),
greedy_(greedy),
loopee_(move(loopee)),
loopee_(std::move(loopee)),
loopeeConstraints_(matchConstraintsForList(loopee_)) {}

/// We inherit the loopee's match constraints unless the loop is optional (min
Expand Down Expand Up @@ -965,7 +963,7 @@ class BracketNode : public Node {

const Traits &traits_;
CodePointSet codePointSet_;
vector<CharacterClass> classes_;
std::vector<CharacterClass> classes_;
bool negate_;
bool icase_;
bool unicode_;
Expand Down Expand Up @@ -1123,18 +1121,19 @@ class Regex {
/// the given args \p args.
/// \return the unique_ptr
template <typename NodeType, typename... Args>
static unique_ptr<NodeType> make_unique(Args &&... args) {
return unique_ptr<NodeType>(new NodeType(forward<Args>(args)...));
static std::unique_ptr<NodeType> make_unique(Args &&... args) {
return std::unique_ptr<NodeType>(new NodeType(std::forward<Args>(args)...));
}

/// Construct and and append a node of type NodeType at the end of the nodes_
/// list. The node should be constructible from \p args.
/// \return an observer pointer to the new node.
template <typename NodeType, typename... Args>
NodeType *appendNode(Args &&... args) {
unique_ptr<NodeType> node = make_unique<NodeType>(forward<Args>(args)...);
std::unique_ptr<NodeType> node =
make_unique<NodeType>(std::forward<Args>(args)...);
NodeType *nodePtr = node.get();
nodes_.push_back(move(node));
nodes_.push_back(std::move(node));
return nodePtr;
}

Expand Down Expand Up @@ -1195,7 +1194,7 @@ class Regex {
// Constructors
Regex() = default;
explicit Regex(const CharT *p, const llvm::ArrayRef<char16_t> f = {})
: Regex(p, p + char_traits<CharT>::length(p), f) {}
: Regex(p, p + std::char_traits<CharT>::length(p), f) {}

Regex(
const CharT *first,
Expand Down Expand Up @@ -1510,7 +1509,8 @@ void Regex<Traits>::pushLookaround(
Node::reverseNodeList(exp);
}
exp.push_back(make_unique<GoalNode>());
appendNode<LookaroundNode>(move(exp), mexpBegin, mexpEnd, invert, forwards);
appendNode<LookaroundNode>(
std::move(exp), mexpBegin, mexpEnd, invert, forwards);
}

void Node::reverseNodeList(NodeList &nodes) {
Expand Down Expand Up @@ -1557,8 +1557,8 @@ void Node::optimizeNodeList(NodeList &nodes, SyntaxFlags flags) {
if (rangeEnd - rangeStart >= 3) {
// We successfully coalesced some nodes.
// Replace the range with a new node.
nodes[rangeStart] =
unique_ptr<MatchCharNode>(new MatchCharNode(std::move(chars), flags));
nodes[rangeStart] = std::unique_ptr<MatchCharNode>(
new MatchCharNode(std::move(chars), flags));
// Fill the remainder of the range with null (we'll clean them up after
// the loop) and skip to the end of the range.
// Note that rangeEnd may be one past the last valid element.
Expand Down
4 changes: 2 additions & 2 deletions lib/Regex/RegexParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class Parser {
auto exprStart = re_->currentNode();
consumeDisjunction();
auto expr = re_->spliceOut(exprStart);
re_->pushMarkedSubexpression(move(expr), mexp);
re_->pushMarkedSubexpression(std::move(expr), mexp);
}
if (!tryConsume(')')) {
setError(constants::ErrorType::UnbalancedParenthesis);
Expand Down Expand Up @@ -834,7 +834,7 @@ class Parser {
consumeDisjunction();
auto mexpEnd = re_->markedCount();
auto expr = re_->spliceOut(exprStart);
re_->pushLookaround(move(expr), mexpBegin, mexpEnd, negate, forwards);
re_->pushLookaround(std::move(expr), mexpBegin, mexpEnd, negate, forwards);
}

/// 21.2.2.9 AtomEscape.
Expand Down

0 comments on commit 603a132

Please sign in to comment.