clang  6.0.0svn
SourceExtraction.h
Go to the documentation of this file.
1 //===--- SourceExtraction.cpp - Clang refactoring library -----------------===//
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_LIB_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H
11 #define LLVM_CLANG_LIB_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H
12 
13 #include "clang/Basic/LLVM.h"
14 
15 namespace clang {
16 
17 class LangOptions;
18 class SourceManager;
19 class SourceRange;
20 class Stmt;
21 
22 namespace tooling {
23 
24 /// Determines which semicolons should be inserted during extraction.
26 public:
28  return IsNeededInExtractedFunction;
29  }
30 
31  bool isNeededInOriginalFunction() const { return IsNeededInOriginalFunction; }
32 
33  /// Returns the semicolon insertion policy that is needed for extraction of
34  /// the given statement from the given source range.
35  static ExtractionSemicolonPolicy compute(const Stmt *S,
36  SourceRange &ExtractedRange,
37  const SourceManager &SM,
38  const LangOptions &LangOpts);
39 
40 private:
41  ExtractionSemicolonPolicy(bool IsNeededInExtractedFunction,
42  bool IsNeededInOriginalFunction)
43  : IsNeededInExtractedFunction(IsNeededInExtractedFunction),
44  IsNeededInOriginalFunction(IsNeededInOriginalFunction) {}
45  bool IsNeededInExtractedFunction;
46  bool IsNeededInOriginalFunction;
47 };
48 
49 } // end namespace tooling
50 } // end namespace clang
51 
52 #endif // LLVM_CLANG_LIB_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H
Stmt - This represents one statement.
Definition: Stmt.h:66
Determines which semicolons should be inserted during extraction.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const SourceManager & SM
Definition: Format.cpp:1337
static ExtractionSemicolonPolicy compute(const Stmt *S, SourceRange &ExtractedRange, const SourceManager &SM, const LangOptions &LangOpts)
Returns the semicolon insertion policy that is needed for extraction of the given statement from the ...
Dataflow Directional Tag Classes.
A trivial tuple used to represent a source range.
This class handles loading and caching of source files into memory.