Commit 1a07ff88 authored by Marius Wachtler's avatar Marius Wachtler

make isCompilerCreatedName() a method of InternedString

parent b145b008
......@@ -108,10 +108,6 @@ static InternedString mangleName(InternedString id, llvm::StringRef private_name
return rtn;
}
static bool isCompilerCreatedName(llvm::StringRef name) {
return name[0] == '!' || name[0] == '#';
}
class ModuleScopeInfo : public ScopeInfo {
public:
ScopeInfo* getParent() override { return NULL; }
......@@ -121,7 +117,7 @@ public:
bool passesThroughClosure() override { return false; }
VarScopeType getScopeTypeOfName(InternedString name) override {
if (isCompilerCreatedName(name))
if (name.isCompilerCreatedName())
return VarScopeType::FAST;
else
return VarScopeType::GLOBAL;
......@@ -185,7 +181,7 @@ public:
bool passesThroughClosure() override { return false; }
VarScopeType getScopeTypeOfName(InternedString name) override {
if (isCompilerCreatedName(name))
if (name.isCompilerCreatedName())
return VarScopeType::FAST;
else if (forced_globals.find(name) != forced_globals.end())
return VarScopeType::GLOBAL;
......@@ -341,7 +337,7 @@ public:
bool passesThroughClosure() override { return usage->passthrough_accesses.size() > 0 && !createsClosure(); }
VarScopeType getScopeTypeOfName(InternedString name) override {
if (isCompilerCreatedName(name))
if (name.isCompilerCreatedName())
return VarScopeType::FAST;
if (usage->forced_globals.count(name) > 0)
......
......@@ -36,4 +36,10 @@ llvm::StringRef InternedString::s() const {
const char* InternedString::c_str() const {
return _str->c_str();
}
bool InternedString::isCompilerCreatedName() const {
char c = _str->s()[0];
return c == '!' || c == '#';
}
}
......@@ -82,6 +82,8 @@ public:
operator llvm::StringRef() const { return s(); }
operator BoxedString*() const { return getBox(); }
bool isCompilerCreatedName() const;
friend class InternedStringPool;
friend struct std::hash<InternedString>;
friend struct std::less<InternedString>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment