LCOV - code coverage report
Current view: top level - clang/tools/extra/clang-tidy/utils - UsingInserter.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             : //===---------- UsingInserter.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_USINGINSERTER_H
      11             : #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_USINGINSERTER_H
      12             : 
      13             : #include "clang/AST/Decl.h"
      14             : #include "clang/AST/Stmt.h"
      15             : #include "clang/Basic/Diagnostic.h"
      16             : #include "clang/Basic/SourceManager.h"
      17             : #include <set>
      18             : 
      19             : namespace clang {
      20             : namespace tidy {
      21             : namespace utils {
      22             : 
      23             : // UsingInserter adds using declarations for |QualifiedName| to the surrounding
      24             : // function.
      25             : // This allows using a shorter name without clobbering other scopes.
      26           6 : class UsingInserter {
      27             : public:
      28             :   UsingInserter(const SourceManager &SourceMgr);
      29             : 
      30             :   // Creates a \p using declaration fixit. Returns ``llvm::None`` on error
      31             :   // or if the using declaration already exists.
      32             :   llvm::Optional<FixItHint>
      33             :   createUsingDeclaration(ASTContext &Context, const Stmt &Statement,
      34             :                          llvm::StringRef QualifiedName);
      35             : 
      36             :   // Returns the unqualified version of the name if there is an
      37             :   // appropriate using declaration and the qualified name otherwise.
      38             :   llvm::StringRef getShortName(ASTContext &Context, const Stmt &Statement,
      39             :                                llvm::StringRef QualifiedName);
      40             : 
      41             : private:
      42             :   typedef std::pair<const FunctionDecl *, std::string> NameInFunction;
      43             :   const SourceManager &SourceMgr;
      44             :   std::set<NameInFunction> AddedUsing;
      45             : };
      46             : 
      47             : } // namespace utils
      48             : } // namespace tidy
      49             : } // namespace clang
      50             : #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_USINGINSERTER_H

Generated by: LCOV version 1.13