<commit_before>/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef CLIF_BACKEND_AST_H_
#define CLIF_BACKEND_AST_H_

// Wrapper for the CLIF backend to retrieve Clang ASTs and TUs.
// Example use:
//
//   std::unique_ptr<TranslationUnitAST> ast(new TranslationUnitAST());
//   ast->init("input.cpp", ASTTranslationUnit::CompilerArgs()));
//   ast->Dump();

#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "gtest/gtest_prod.h"  // Defines FRIEND_TEST.
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"

extern llvm::cl::opt<std::string> install_location;

namespace clif {

static const char kSharedPtrName[] = "shared_ptr";
static const char kUniquePtrName[] = "unique_ptr";

class TranslationUnitASTTest;

// In clang, decl subtypes inherit from NamedDecl.  Dynamically cast
// the contained value to the appropriate kind.
typedef std::unordered_multimap<std::string,
                                clang::NamedDecl*> DeclMap;
typedef std::pair<DeclMap::iterator, DeclMap::iterator> DeclRange;<commit_msg>Integrate from upstream at revision 37e145812855.<commit_after>/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef CLIF_BACKEND_AST_H_
#define CLIF_BACKEND_AST_H_

// Wrapper for the CLIF backend to retrieve Clang ASTs and TUs.
// Example use:
//
//   std::unique_ptr<TranslationUnitAST> ast(new TranslationUnitAST());
//   ast->init("input.cpp", ASTTranslationUnit::CompilerArgs()));
//   ast->Dump();

#include <memory>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "gtest/gtest_prod.h"  // Defines FRIEND_TEST.
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"

extern llvm::cl::opt<std::string> install_location;

namespace clif {

static const char kSharedPtrName[] = "shared_ptr";
static const char kUniquePtrName[] = "unique_ptr";

class TranslationUnitASTTest;

// In clang, decl subtypes inherit from NamedDecl.  Dynamically cast
// the contained value to the appropriate kind.
typedef std::unordered_multimap<std::string,
                                clang::NamedDecl*> DeclMap;
typedef std::pair<DeclMap::iterator, DeclMap::iterator> DeclRange;
{'fraction_non_alphanumeric': 0.114758335487206, 'fraction_numerical': 0.00697854742827604, 'mean_word_length': 4.584415584415584, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7176004', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1188, 'n_words': 368}