| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | #ifndef LLVM_CLANG_ARCMIGRATE_ARCMT_H |
| 10 | #define LLVM_CLANG_ARCMIGRATE_ARCMT_H |
| 11 | |
| 12 | #include "clang/ARCMigrate/FileRemapper.h" |
| 13 | #include "clang/Basic/SourceLocation.h" |
| 14 | #include "clang/Frontend/CompilerInvocation.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | class ASTContext; |
| 18 | class DiagnosticConsumer; |
| 19 | class PCHContainerOperations; |
| 20 | |
| 21 | namespace arcmt { |
| 22 | class MigrationPass; |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | bool |
| 41 | checkForManualIssues(CompilerInvocation &CI, const FrontendInputFile &Input, |
| 42 | std::shared_ptr<PCHContainerOperations> PCHContainerOps, |
| 43 | DiagnosticConsumer *DiagClient, |
| 44 | bool emitPremigrationARCErrors = false, |
| 45 | StringRef plistOut = StringRef()); |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | bool |
| 52 | applyTransformations(CompilerInvocation &origCI, |
| 53 | const FrontendInputFile &Input, |
| 54 | std::shared_ptr<PCHContainerOperations> PCHContainerOps, |
| 55 | DiagnosticConsumer *DiagClient); |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | bool migrateWithTemporaryFiles( |
| 69 | CompilerInvocation &origCI, const FrontendInputFile &Input, |
| 70 | std::shared_ptr<PCHContainerOperations> PCHContainerOps, |
| 71 | DiagnosticConsumer *DiagClient, StringRef outputDir, |
| 72 | bool emitPremigrationARCErrors, StringRef plistOut); |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap, |
| 79 | StringRef outputDir, |
| 80 | DiagnosticConsumer *DiagClient); |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | bool getFileRemappingsFromFileList( |
| 87 | std::vector<std::pair<std::string,std::string> > &remap, |
| 88 | ArrayRef<StringRef> remapFiles, |
| 89 | DiagnosticConsumer *DiagClient); |
| 90 | |
| 91 | typedef void (*TransformFn)(MigrationPass &pass); |
| 92 | |
| 93 | std::vector<TransformFn> getAllTransformations(LangOptions::GCMode OrigGCMode, |
| 94 | bool NoFinalizeRemoval); |
| 95 | |
| 96 | class MigrationProcess { |
| 97 | CompilerInvocation OrigCI; |
| 98 | std::shared_ptr<PCHContainerOperations> PCHContainerOps; |
| 99 | DiagnosticConsumer *DiagClient; |
| 100 | FileRemapper Remapper; |
| 101 | |
| 102 | public: |
| 103 | bool HadARCErrors; |
| 104 | |
| 105 | MigrationProcess(const CompilerInvocation &CI, |
| 106 | std::shared_ptr<PCHContainerOperations> PCHContainerOps, |
| 107 | DiagnosticConsumer *diagClient, |
| 108 | StringRef outputDir = StringRef()); |
| 109 | |
| 110 | class RewriteListener { |
| 111 | public: |
| 112 | virtual ~RewriteListener(); |
| 113 | |
| 114 | virtual void start(ASTContext &Ctx) { } |
| 115 | virtual void finish() { } |
| 116 | |
| 117 | virtual void insert(SourceLocation loc, StringRef text) { } |
| 118 | virtual void remove(CharSourceRange range) { } |
| 119 | }; |
| 120 | |
| 121 | bool applyTransform(TransformFn trans, RewriteListener *listener = nullptr); |
| 122 | |
| 123 | FileRemapper &getRemapper() { return Remapper; } |
| 124 | }; |
| 125 | |
| 126 | } |
| 127 | |
| 128 | } |
| 129 | |
| 130 | #endif |
| 131 | |