Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:11

0001 //===--- SourceExtraction.cpp - Clang refactoring library -----------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCEEXTRACTION_H
0010 #define LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCEEXTRACTION_H
0011 
0012 #include "clang/Basic/LLVM.h"
0013 
0014 namespace clang {
0015 
0016 class LangOptions;
0017 class SourceManager;
0018 class SourceRange;
0019 class Stmt;
0020 
0021 namespace tooling {
0022 
0023 /// Determines which semicolons should be inserted during extraction.
0024 class ExtractionSemicolonPolicy {
0025 public:
0026   bool isNeededInExtractedFunction() const {
0027     return IsNeededInExtractedFunction;
0028   }
0029 
0030   bool isNeededInOriginalFunction() const { return IsNeededInOriginalFunction; }
0031 
0032   /// Returns the semicolon insertion policy that is needed for extraction of
0033   /// the given statement from the given source range.
0034   static ExtractionSemicolonPolicy compute(const Stmt *S,
0035                                            SourceRange &ExtractedRange,
0036                                            const SourceManager &SM,
0037                                            const LangOptions &LangOpts);
0038 
0039 private:
0040   ExtractionSemicolonPolicy(bool IsNeededInExtractedFunction,
0041                             bool IsNeededInOriginalFunction)
0042       : IsNeededInExtractedFunction(IsNeededInExtractedFunction),
0043         IsNeededInOriginalFunction(IsNeededInOriginalFunction) {}
0044   bool IsNeededInExtractedFunction;
0045   bool IsNeededInOriginalFunction;
0046 };
0047 
0048 } // end namespace tooling
0049 } // end namespace clang
0050 
0051 #endif // LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCEEXTRACTION_H