//===--- Benchmark.cpp - clang pseudoparser benchmarks ---------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Benchmark for the overall pseudoparser performance, it also includes other // important pieces of the pseudoparser (grammar compliation, LR table build // etc). // // Note: make sure to build the benchmark in Release mode. // // Usage: // tools/clang/tools/extra/pseudo/benchmarks/ClangPseudoBenchmark \ // --grammar=../clang-tools-extra/pseudo/lib/cxx.bnf \ // --source=../clang/lib/Sema/SemaDecl.cpp // //===----------------------------------------------------------------------===// #include "benchmark/benchmark.h" #include "clang-pseudo/Bracket.h" #include "clang-pseudo/DirectiveTree.h" #include "clang-pseudo/Forest.h" #include "clang-pseudo/GLR.h" #include "clang-pseudo/Token.h" #include "clang-pseudo/cli/CLI.h" #include "clang-pseudo/grammar/Grammar.h" #include "clang-pseudo/grammar/LRTable.h" #include "clang/Basic/LangOptions.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include <string> desc; opt; Required; static opt<std::string> Source("source", desc("Source file"), Required); namespace clang { namespace pseudo { namespace bench { namespace … // namespace } // namespace bench } // namespace pseudo } // namespace clang int main(int argc, char *argv[]) { … }