1 //===--- SourceExtraction.cpp - Clang refactoring library -----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H
10 #define LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H
12 #include "clang/Basic/LLVM.h"
23 /// Determines which semicolons should be inserted during extraction.
24 class ExtractionSemicolonPolicy {
26 bool isNeededInExtractedFunction() const {
27 return IsNeededInExtractedFunction;
30 bool isNeededInOriginalFunction() const { return IsNeededInOriginalFunction; }
32 /// Returns the semicolon insertion policy that is needed for extraction of
33 /// the given statement from the given source range.
34 static ExtractionSemicolonPolicy compute(const Stmt *S,
35 SourceRange &ExtractedRange,
36 const SourceManager &SM,
37 const LangOptions &LangOpts);
40 ExtractionSemicolonPolicy(bool IsNeededInExtractedFunction,
41 bool IsNeededInOriginalFunction)
42 : IsNeededInExtractedFunction(IsNeededInExtractedFunction),
43 IsNeededInOriginalFunction(IsNeededInOriginalFunction) {}
44 bool IsNeededInExtractedFunction;
45 bool IsNeededInOriginalFunction;
48 } // end namespace tooling
49 } // end namespace clang
51 #endif //LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCE_EXTRACTION_H