clang  10.0.0svn
Classes | Namespaces | Typedefs | Enumerations | Functions
RewriteRule.h File Reference

Defines the RewriteRule class and related functions for creating, modifying and interpreting RewriteRules. More...

#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/Tooling/Refactoring/AtomicChange.h"
#include "clang/Tooling/Transformer/MatchConsumer.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Error.h"
#include <functional>
#include <string>
#include <utility>
Include dependency graph for RewriteRule.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  clang::transformer::ASTEdit
 
struct  clang::transformer::RewriteRule
 Description of a source-code transformation. More...
 
struct  clang::transformer::RewriteRule::Case
 
struct  clang::transformer::detail::Transformation
 A source "transformation," represented by a character range in the source to be replaced and a corresponding replacement string. More...
 

Namespaces

 clang
 Dataflow Directional Tag Classes.
 
 clang::transformer
 
 clang::transformer::detail
 The following three functions are a low-level part of the RewriteRule API.
 
 clang::tooling
 
 clang::tooling::detail
 

Typedefs

using clang::transformer::TextGenerator = MatchConsumer< std::string >
 
using clang::tooling::TextGenerator = transformer::TextGenerator
 Wraps a string as a TextGenerator. More...
 

Enumerations

enum  clang::transformer::IncludeFormat { clang::transformer::IncludeFormat::Quoted, clang::transformer::IncludeFormat::Angled }
 Format of the path in an include directive – angle brackets or quotes. More...
 

Functions

RewriteRule clang::transformer::makeRule (ast_matchers::internal::DynTypedMatcher M, SmallVector< ASTEdit, 1 > Edits, TextGenerator Explanation=nullptr)
 Convenience function for constructing a simple RewriteRule. More...
 
RewriteRule clang::transformer::makeRule (ast_matchers::internal::DynTypedMatcher M, ASTEdit Edit, TextGenerator Explanation=nullptr)
 Convenience overload of makeRule for common case of only one edit. More...
 
void clang::transformer::addInclude (RewriteRule &Rule, llvm::StringRef Header, IncludeFormat Format=IncludeFormat::Quoted)
 For every case in Rule, adds an include directive for the given header. More...
 
RewriteRule clang::transformer::applyFirst (ArrayRef< RewriteRule > Rules)
 Applies the first rule whose pattern matches; other rules are ignored. More...
 
ASTEdit clang::transformer::change (RangeSelector Target, TextGenerator Replacement)
 Replaces a portion of the source text with Replacement. More...
 
ASTEdit clang::transformer::change (TextGenerator Replacement)
 Replaces the entirety of a RewriteRule's match with Replacement. More...
 
ASTEdit clang::transformer::insertBefore (RangeSelector S, TextGenerator Replacement)
 Inserts Replacement before S, leaving the source selected by unchanged. More...
 
ASTEdit clang::transformer::insertAfter (RangeSelector S, TextGenerator Replacement)
 Inserts Replacement after S, leaving the source selected by unchanged. More...
 
ASTEdit clang::transformer::remove (RangeSelector S)
 Removes the source selected by S. More...
 
ast_matchers::internal::DynTypedMatcher clang::transformer::detail::buildMatcher (const RewriteRule &Rule)
 Builds a single matcher for the rule, covering all of the rule's cases. More...
 
std::vector< ast_matchers::internal::DynTypedMatcher > clang::transformer::detail::buildMatchers (const RewriteRule &Rule)
 Builds a set of matchers that cover the rule (one for each distinct node matcher base kind: Stmt, Decl, etc.). More...
 
SourceLocation clang::transformer::detail::getRuleMatchLoc (const ast_matchers::MatchFinder::MatchResult &Result)
 Gets the beginning location of the source matched by a rewrite rule. More...
 
const RewriteRule::Caseclang::transformer::detail::findSelectedCase (const ast_matchers::MatchFinder::MatchResult &Result, const RewriteRule &Rule)
 Returns the Case of Rule that was selected in the match result. More...
 
Expected< SmallVector< Transformation, 1 > > clang::transformer::detail::translateEdits (const ast_matchers::MatchFinder::MatchResult &Result, llvm::ArrayRef< ASTEdit > Edits)
 Attempts to translate Edits, which are in terms of AST nodes bound in the match Result, into Transformations, which are in terms of the source code text. More...
 
TextGenerator clang::tooling::text (std::string M)
 

Detailed Description

Defines the RewriteRule class and related functions for creating, modifying and interpreting RewriteRules.

Definition in file RewriteRule.h.