Skip to content

Commit 3d14f29

Browse files
okunzcopybara-github
authored andcommitted
Minor cleanups
PiperOrigin-RevId: 742654540 Change-Id: I6b1e708ca4d542829a2e2feadc1b23a2f52baaa6
1 parent b29fe90 commit 3d14f29

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

sandboxed_api/tools/clang_generator/frontend_action_test_util.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ std::vector<std::string> FrontendActionTest::GetCommandLineFlagsForTesting(
7979
"-I.", "-Wno-error", std::string(input_file)};
8080
}
8181

82+
// Replaces all newlines with spaces and removes consecutive runs of whitespace.
8283
std::string Uglify(absl::string_view code) {
8384
std::string result = absl::StrReplaceAll(code, {{"\n", " "}});
8485
absl::RemoveExtraAsciiWhitespace(&result);

sandboxed_api/tools/clang_generator/frontend_action_test_util.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
namespace sapi {
3232
namespace internal {
3333

34+
// Sets up a virtual filesystem, adds code files to it, and runs a clang tool
35+
// on it.
3436
absl::Status RunClangTool(
3537
const std::vector<std::string>& command_line,
3638
const absl::flat_hash_map<std::string, std::string>& file_contents,
@@ -51,6 +53,7 @@ class FrontendActionTest : public ::testing::Test {
5153
input_file_ = std::string(value);
5254
}
5355

56+
// Returns the command line flags for the specified input file.
5457
virtual std::vector<std::string> GetCommandLineFlagsForTesting(
5558
absl::string_view input_file);
5659

@@ -76,12 +79,10 @@ class FrontendActionTest : public ::testing::Test {
7679
absl::flat_hash_map<std::string, std::string> file_contents_;
7780
};
7881

79-
// Flattens a piece of C++ code into one line and removes consecutive runs of
80-
// whitespace. This makes it easier to compare code snippets for testing.
81-
// Note: This is not syntax-aware and will replace characters within strings as
82-
// well.
83-
std::string Uglify(absl::string_view code);
84-
82+
// Flattens a vector of C++ code snippets into one line and removes consecutive
83+
// runs of whitespace. This makes it easier to compare code snippets for
84+
// testing. Note: This is not syntax-aware and will replace characters within
85+
// strings as well.
8586
std::vector<std::string> UglifyAll(const std::vector<std::string>& snippets);
8687

8788
} // namespace sapi

0 commit comments

Comments
 (0)