/llvm-project/llvm/unittests/Support/ |
H A D | FormatVariadicTest.cpp | 46 auto Replacements = parseFormatString(""); in TEST() 47 EXPECT_EQ(0U, Replacements.size()); in TEST() 52 auto Replacements = parseFormatString(kFormatString); in TEST() 53 ASSERT_EQ(1U, Replacements.size()); in TEST() local 54 EXPECT_EQ(kFormatString, Replacements[0].Spec); in TEST() 55 EXPECT_EQ(ReplacementType::Literal, Replacements[0].Type); in TEST() 60 auto Replacements = parseFormatString("{{"); in TEST() 61 ASSERT_EQ(1u, Replacements.size()); in TEST() 62 EXPECT_EQ("{", Replacements[0].Spec); in TEST() 63 EXPECT_EQ(ReplacementType::Literal, Replacements[ in TEST() 39 auto Replacements = formatv_object_base::parseFormatString(""); TEST() local 45 auto Replacements = formatv_object_base::parseFormatString(kFormatString); TEST() local 79 auto Replacements = formatv_object_base::parseFormatString("{0}"); TEST() local 214 auto Replacements = formatv_object_base::parseFormatString("{0,3}"); TEST() local 241 auto Replacements = TEST() local [all...] |
/llvm-project/clang/include/clang/Tooling/Core/ |
H A D | Replacement.h | 115 /// Only replacements that are in a valid file can be applied. 153 /// e.g. fail applying replacements and replacements conflict. 163 /// replacement in a set of replacements. 193 // replacements, that is causing problem. 196 // An existing replacement in a replacements set that is causing problem. 200 /// Less-than operator between two Replacements. 203 /// Equal-to operator between two Replacements. 209 /// Maintains a set of replacements that are conflict-free. 210 /// Two replacements are considered conflicts if they overlap or have the same 212 class Replacements { [all …]
|
/llvm-project/clang/unittests/Tooling/ |
H A D | ReplacementsYamlTest.cpp | 9 // Tests for serialization of Replacements. 24 Doc.Replacements.emplace_back("/path/to/file1.h", 232, 56, "replacement #1"); in TEST() 25 Doc.Replacements.emplace_back("/path/to/file2.h", 301, 2, "replacement #2"); in TEST() 36 "Replacements:\n" in TEST() 53 Doc.Replacements.emplace_back("/path/to/file1.h", 0, 0, "#include <utility>\n"); in TEST() 64 "Replacements:\n" in TEST() 76 "Replacements:\n" in TEST() 90 ASSERT_EQ(2u, DocActual.Replacements.size()); in TEST() 92 ASSERT_EQ("/path/to/file1.h", DocActual.Replacements[0].getFilePath()); in TEST() 93 ASSERT_EQ(232u, DocActual.Replacements[0].getOffset()); in TEST() [all …]
|
H A D | ReplacementTest.h | 1 //===- unittest/Tooling/ReplacementTest.h - Replacements related test------===// 23 /// \brief Converts a set of replacements to Replacements class. 24 /// \return A Replacements class containing \p Replaces on success; otherwise, 25 /// an empty Replacements is returned. 26 inline tooling::Replacements 28 tooling::Replacements Result; in toReplacements() 34 return tooling::Replacements(); in toReplacements()
|
H A D | DiagnosticsYamlTest.cpp | 25 const std::string &FilePath, const StringMap<Replacements> &Fix, in makeMessage() 49 const StringMap<Replacements> &Fix, in makeDiagnostic() 66 " Replacements:\n" 78 " Replacements:\n" 94 " Replacements: []\n" 99 " Replacements: []\n" 103 " Replacements: []\n" 111 " Replacements: []\n" 120 StringMap<Replacements> Fix1 = { in TEST() 122 Replacements({"pat in TEST() 168 for (auto &Replacements : Fix) { TEST() local [all...] |
H A D | RefactoringTest.cpp | 144 Replacements Replaces; in TEST_F() 173 Replacements Replaces; in TEST_F() 189 Replacements Replaces; in TEST_F() 208 Replacements Replaces; in TEST_F() 230 Replacements Replaces; in TEST_F() 253 Replacements Replaces; in TEST_F() 278 Replacements Replaces; in TEST_F() 300 Replacements Replaces; in TEST_F() 320 Replacements Replaces; in TEST_F() 340 Replacements Replace [all...] |
/llvm-project/clang/lib/Tooling/Refactoring/ |
H A D | AtomicChange.cpp | 26 // This converts AtomicChange's internal implementation of the replacements 27 // set to a vector of replacements. 61 Io.mapRequired("Replacements", Doc.Replaces); in mapping() 76 Io.mapRequired("Replacements", Keys->Replaces); in mapping() 109 const clang::tooling::Replacements &Replaces) { in getRangesForFormating() 114 // This works assuming that replacements are ordered by offset. in getRangesForFormating() 142 // Creates replacements for inserting/deleting #include headers. 143 llvm::Expected<Replacements> 147 // Create header insertion/deletion replacements to be cleaned up in createReplacementsForHeaders() 148 // (i.e. converted to real insertion/deletion replacements) in createReplacementsForHeaders() [all...] |
/llvm-project/clang/lib/Tooling/Core/ |
H A D | Replacement.cpp | 158 Replacements::getReplacementInChangedCode(const Replacement &R) const { in getReplacementInChangedCode() 171 "existing replacements"; in getReplacementErrString() 192 Replacements Replacements::getCanonicalReplacements() const { in getCanonicalReplacements() 194 // Merge adjacent replacements. in getCanonicalReplacements() 206 "Existing replacements must not overlap."); in getCanonicalReplacements() 214 return Replacements(NewReplacesImpl.begin(), NewReplacesImpl.end()); in getCanonicalReplacements() 218 // has the same effect, so we need to compare replacements associated to 220 llvm::Expected<Replacements> 221 Replacements [all...] |
/llvm-project/clang/include/clang/Tooling/ |
H A D | Refactoring.h | 35 /// passed to run() and runAndSave() should add replacements to 45 /// Returns the file path to replacements map to which replacements 47 std::map<std::string, Replacements> &getReplacements(); 49 /// Call run(), apply all generated replacements, and immediately save 55 /// Apply all stored replacements to the given Rewriter. 63 /// \returns true if all replacements apply. false otherwise. 71 std::map<std::string, Replacements> FileToReplaces; 75 /// Replacements on the related file in \p Rewriter. In addition to applying 76 /// given Replacements, this function also formats the changed code. 78 /// \pre Replacements must be conflict-free. [all …]
|
H A D | RefactoringCallbacks.h | 39 /// Collects \c tooling::Replacements while running. 43 Replacements &getReplacements(); 46 Replacements Replace; 52 /// Runs AST matchers and stores the \c tooling::Replacements in a map. 56 std::map<std::string, Replacements> &FileToReplaces); 73 std::map<std::string, Replacements> &FileToReplaces;
|
/llvm-project/clang-tools-extra/clang-reorder-fields/ |
H A D | ReorderFieldsAction.cpp | 87 std::map<std::string, tooling::Replacements> &Replacements) { in addReplacement() 94 consumeError(Replacements[std::string(R.getFilePath())].add(R)); 198 std::map<std::string, tooling::Replacements> &Replacements) { in reorderFieldsInConstructor() 222 Context, Replacements); 235 std::map<std::string, tooling::Replacements> &Replacements) { in reorderFieldsInInitListExpr() 288 Replacements); in HandleTranslationUnit() 298 std::map<std::string, tooling::Replacements> in HandleTranslationUnit() 85 addReplacement(SourceRange Old,SourceRange New,const ASTContext & Context,std::map<std::string,tooling::Replacements> & Replacements) addReplacement() argument 127 reorderFieldsInDefinition(const RecordDecl * Definition,ArrayRef<unsigned> NewFieldsOrder,const ASTContext & Context,std::map<std::string,tooling::Replacements> & Replacements) reorderFieldsInDefinition() argument 163 reorderFieldsInConstructor(const CXXConstructorDecl * CtorDecl,ArrayRef<unsigned> NewFieldsOrder,ASTContext & Context,std::map<std::string,tooling::Replacements> & Replacements) reorderFieldsInConstructor() argument 226 reorderFieldsInInitListExpr(const InitListExpr * InitListEx,ArrayRef<unsigned> NewFieldsOrder,const ASTContext & Context,std::map<std::string,tooling::Replacements> & Replacements) reorderFieldsInInitListExpr() argument 255 std::map<std::string, tooling::Replacements> &Replacements; global() member in clang::reorder_fields::__anonf16ad7160211::ReorderingConsumer 260 ReorderingConsumer(StringRef RecordName,ArrayRef<std::string> DesiredFieldsOrder,std::map<std::string,tooling::Replacements> & Replacements) ReorderingConsumer() argument [all...] |
H A D | ReorderFieldsAction.h | 28 std::map<std::string, tooling::Replacements> &Replacements; variable 34 std::map<std::string, tooling::Replacements> &Replacements) in ReorderFieldsAction() argument 36 Replacements(Replacements) {} in ReorderFieldsAction()
|
/llvm-project/clang-tools-extra/clang-apply-replacements/lib/Tooling/ |
H A D | ApplyReplacements.cpp | 1 //===-- ApplyReplacements.cpp - Apply and deduplicate replacements --------===// 11 /// conflicts in, and applying collections of Replacements. 16 #include "clang-apply-replacements/Tooling/ApplyReplacements.h" 110 /// Extract replacements from collected TranslationUnitReplacements and 111 /// TranslationUnitDiagnostics and group them per file. Identical replacements 129 // Deduplicate identical replacements in diagnostics unless they are from the in groupReplacements() 164 for (const tooling::Replacement &R : TU.Replacements) in groupReplacements() 175 // Sort replacements per file to keep consistent behavior when in groupReplacements() 176 // clang-apply-replacements run on differents machine. in groupReplacements() 190 // To report conflicting replacements o in mergeAndDeduplicate() 219 tooling::Replacements &Replacements = FileChange.getReplacements(); mergeAndDeduplicate() local [all...] |
/llvm-project/clang-tools-extra/test/ |
H A D | .gitattributes | 7 clang-apply-replacements/ClangRenameClassReplacements.cpp -text 8 clang-apply-replacements/Inputs/basic/basic.h -text 9 clang-apply-replacements/Inputs/format/no.cpp -text 10 clang-apply-replacements/Inputs/format/yes.cpp -text 14 clang-apply-replacements/Inputs/crlf/crlf.cpp -text 15 clang-apply-replacements/Inputs/crlf/crlf.cpp.expected -text
|
/llvm-project/clang-tools-extra/clangd/ |
H A D | Format.cpp | 109 tooling::Replacements Changes; 233 // Returns equivalent replacements that preserve the correspondence between 237 split(const tooling::Replacements &Replacements, unsigned OldCursor, in split() argument 241 for (const tooling::Replacement &R : Replacements) { in split() 271 // The replacements we return are produced by composing these. 317 tooling::Replacements FormattingChanges; in formatIncremental() 338 // We must express insert/remove as Replacements. in formatIncremental() 339 tooling::Replacements InsertCursorPlaceholder( in formatIncremental() 345 tooling::Replacements RemoveCursorPlaceholder( in formatIncremental() 349 // We can't simply merge() and return: tooling::Replacements will combine in formatIncremental() [all …]
|
H A D | Format.h | 38 /// We return sorted vector<tooling::Replacement>, not tooling::Replacements! 39 /// We may insert text both before and after the cursor. tooling::Replacements 45 /// Determine the new cursor position after applying \p Replacements. 46 /// Analogue of tooling::Replacements::getShiftedCodePosition(). 49 const std::vector<tooling::Replacement> &Replacements);
|
/llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/ |
H A D | export-diagnostics.cpp | 35 // CHECK-YAML-NEXT: Replacements: [] 40 // CHECK-YAML-NEXT: Replacements: [] 44 // CHECK-YAML-NEXT: Replacements: [] 48 // CHECK-YAML-NEXT: Replacements: 56 // CHECK-YAML-NEXT: Replacements: [] 64 // CHECK-YAML-NEXT: Replacements: [] 76 // CHECK-YAML-NEXT: Replacements: [] 88 // CHECK-YAML-NEXT: Replacements: [] 96 // CHECK-YAML-NEXT: Replacements: [] 104 // CHECK-YAML-NEXT: Replacements:
|
/llvm-project/clang-tools-extra/clang-tidy/ |
H A D | ClangTidy.cpp | 136 const llvm::StringMap<Replacements> *ChosenFix = nullptr; in reportDiagnostic() 151 Replacements &Replacements = Entry.Replaces; in reportDiagnostic() local 152 llvm::Error Err = Replacements.add(R); in reportDiagnostic() 158 Replacements.getShiftedCodePosition(R.getOffset()); in reportDiagnostic() 159 unsigned NewLength = Replacements.getShiftedCodePosition( in reportDiagnostic() 165 Replacements = Replacements.merge(tooling::Replacements(R)); in reportDiagnostic() 217 llvm::Expected<tooling::Replacements> Replacement in finish() local [all...] |
/llvm-project/clang/tools/clang-format/ |
H A D | clang-format.el | 88 "Extract replacements and cursor information from XML-NODE." 89 (unless (and (listp xml-node) (eq (xml-node-name xml-node) 'replacements)) 90 (error "Expected <replacements> node")) 93 replacements 110 (push (list offset length text) replacements))) 115 (setq replacements (sort (delq nil replacements) 121 (list replacements cursor (string= incomplete-format "true")))) 183 `("--output-replacements-xml" 207 (cl-destructuring-bind (replacements curso [all...] |
/llvm-project/clang/include/clang/Tooling/Refactoring/ |
H A D | AtomicChange.h | 10 // changes, e.g. replacements and header insertions. 28 /// e.g. replacements or header insertions. Edits in an AtomicChange should be 29 /// related, e.g. replacements for the same type reference and the corresponding 74 /// conflicts among replacements, use this to set an error description. 116 /// Returns a const reference to existing replacements. 117 const Replacements &getReplacements() const { return Replaces; } in getReplacements() 119 Replacements &getReplacements() { return Replaces; } in getReplacements() 137 clang::tooling::Replacements Replaces); 145 tooling::Replacements Replaces;
|
/llvm-project/clang/include/clang/Tooling/Refactoring/Rename/ |
H A D | RenamingAction.h | 34 std::map<std::string, tooling::Replacements> &FileToReplaces, 44 std::map<std::string, tooling::Replacements> &FileToReplaces; 91 /// Returns source replacements that correspond to the rename of the given 103 std::map<std::string, tooling::Replacements> &FileToReplaces) in QualifiedRenamingAction() 115 /// A file path to replacements map. 116 std::map<std::string, tooling::Replacements> &FileToReplaces;
|
/llvm-project/clang-tools-extra/clangd/refactor/tweaks/ |
H A D | DefineInline.cpp | 136 // Go over all references inside a function body to generate replacements that in qualifyAllDecls() 147 tooling::Replacements Replacements; in qualifyAllDecls() local 190 if (auto Err = Replacements.add( in qualifyAllDecls() 209 unsigned BodyEnd = Replacements.getShiftedCodePosition( in qualifyAllDecls() 214 SM.getBufferData(SM.getFileID(OrigBodyRange->getBegin())), Replacements); in qualifyAllDecls() 220 /// Generates Replacements for changing template and function parameter names in 222 llvm::Expected<tooling::Replacements> 284 tooling::Replacements Replacements; in renameParameters() local 309 if (auto Err = Replacements.add( in renameParameters() 318 return Replacements; in renameParameters() [all …]
|
/llvm-project/clang-tools-extra/test/clang-apply-replacements/ |
H A D | format.cpp | 3 // yes.cpp requires formatting after replacements are applied. no.cpp does not. 5 // have their new state written to disk after applying replacements. 11 // RUN: clang-apply-replacements -format %T/Inputs/format 15 // RUN not clang-apply-replacements -format=blah %T/Inputs/format
|
/llvm-project/clang/lib/Format/ |
H A D | TokenAnalyzer.cpp | 11 /// classes. TokenAnalyzer can be extended to generate replacements based on 100 std::pair<tooling::Replacements, unsigned> 102 tooling::Replacements Result; in process() 129 std::pair<tooling::Replacements, unsigned> RunResult = in process() 133 llvm::dbgs() << "Replacements for run " << Run << ":\n"; in process() 144 // Replacements to indicate failure. in process() 147 return {tooling::Replacements(), 0}; in process()
|
H A D | QualifierAlignmentFixer.h | 23 typedef std::function<std::pair<tooling::Replacements, unsigned>( 57 std::pair<tooling::Replacements, unsigned> 66 tooling::Replacements &Fixes); 70 tooling::Replacements &Fixes, 77 tooling::Replacements &Fixes,
|