LCOV - code coverage report
Current view: top level - clang/tools/extra/clang-tidy/utils - NamespaceAliaser.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2017-09-14 15:23:50 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===---------- NamespaceAliaser.h - clang-tidy ---------------------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NAMESPACEALIASER_H
      11             : #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NAMESPACEALIASER_H
      12             : 
      13             : #include "clang/AST/ASTContext.h"
      14             : #include "clang/AST/Stmt.h"
      15             : #include "clang/Basic/Diagnostic.h"
      16             : #include "clang/Basic/SourceManager.h"
      17             : #include "llvm/ADT/DenseMap.h"
      18             : #include "llvm/ADT/StringMap.h"
      19             : #include <map>
      20             : 
      21             : namespace clang {
      22             : namespace tidy {
      23             : namespace utils {
      24             : 
      25             : // This class creates function-level namespace aliases.
      26          10 : class NamespaceAliaser {
      27             : public:
      28             :   explicit NamespaceAliaser(const SourceManager &SourceMgr);
      29             :   // Adds a namespace alias for \p Namespace valid near \p
      30             :   // Statement. Picks the first available name from \p Abbreviations.
      31             :   // Returns ``llvm::None`` if an alias already exists or there is an error.
      32             :   llvm::Optional<FixItHint>
      33             :   createAlias(ASTContext &Context, const Stmt &Statement,
      34             :               llvm::StringRef Namespace,
      35             :               const std::vector<std::string> &Abbreviations);
      36             : 
      37             :   // Get an alias name for \p Namespace valid at \p Statement. Returns \p
      38             :   // Namespace if there is no alias.
      39             :   std::string getNamespaceName(ASTContext &Context, const Stmt &Statement,
      40             :                                llvm::StringRef Namespace) const;
      41             : 
      42             : private:
      43             :   const SourceManager &SourceMgr;
      44             :   llvm::DenseMap<const FunctionDecl *, llvm::StringMap<std::string>>
      45             :       AddedAliases;
      46             : };
      47             : 
      48             : } // namespace utils
      49             : } // namespace tidy
      50             : } // namespace clang
      51             : 
      52             : #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_NAMESPACEALIASER_H

Generated by: LCOV version 1.13