/src/hermes/lib/Support/InternalIdentifierMaker.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | | * |
4 | | * This source code is licensed under the MIT license found in the |
5 | | * LICENSE file in the root directory of this source tree. |
6 | | */ |
7 | | |
8 | | #include "hermes/Support/InternalIdentifierMaker.h" |
9 | | |
10 | | #include "llvh/ADT/SmallString.h" |
11 | | #include "llvh/Support/raw_ostream.h" |
12 | | |
13 | | namespace hermes { |
14 | | |
15 | 136k | Identifier InternalIdentifierMaker::next(llvh::StringRef hint) { |
16 | 136k | llvh::SmallString<16> buf; |
17 | 136k | llvh::raw_svector_ostream nameBuilder{buf}; |
18 | 136k | nameBuilder << "?anon_" << counter_++ << "_" << hint; |
19 | 136k | return stringTable_.getIdentifier(nameBuilder.str()); |
20 | 136k | } |
21 | | } // namespace hermes |