clang: include/clang/Edit/EditedSource.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_EDIT_EDITEDSOURCE_H

10#define LLVM_CLANG_EDIT_EDITEDSOURCE_H

11

16#include "llvm/ADT/DenseMap.h"

17#include "llvm/ADT/SmallVector.h"

18#include "llvm/ADT/StringRef.h"

19#include "llvm/Support/Allocator.h"

20#include

21#include

22#include

23

25

29

30namespace edit {

31

34

39

40 struct FileEdit {

41 StringRef Text;

42 unsigned RemoveLen = 0;

43

44 FileEdit() = default;

45 };

46

47 using FileEditsTy = std::map<FileOffset, FileEdit>;

48

49 FileEditsTy FileEdits;

50

51 struct MacroArgUse {

54

55

57

59 return std::tie(Identifier, ImmediateExpansionLoc, UseLoc) ==

60 std::tie(Other.Identifier, Other.ImmediateExpansionLoc,

62 }

63 };

64

65 llvm::DenseMap<SourceLocation, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;

67 CurrCommitMacroArgExps;

68

70 llvm::BumpPtrAllocator StrAlloc;

71

72public:

75 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts) {}

76

79

83

85

87

90

91 StringRef copyString(StringRef str) { return str.copy(StrAlloc); }

92 StringRef copyString(const Twine &twine);

93

94private:

96 bool beforePreviousInsertions);

98 FileOffset InsertFromRangeOffs, unsigned Len,

99 bool beforePreviousInsertions);

101

104 FileEditsTy::iterator getActionForOffset(FileOffset Offs);

107 MacroArgUse &ArgUse);

108

109 void startingCommit();

110 void finishedCommit();

111};

112

113}

114

115}

116

117#endif

Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

Defines the clang::SourceLocation class and associated facilities.

One of these records is kept for each identifier that is lexed.

Implements an efficient mapping from strings to IdentifierInfo nodes.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

Records preprocessor conditional directive regions and allows querying in which region source locatio...

Encodes a location in the source.

This class handles loading and caching of source files into memory.

const LangOptions & getLangOpts() const

Definition EditedSource.h:78

StringRef copyString(StringRef str)

Definition EditedSource.h:91

const PPConditionalDirectiveRecord * getPPCondDirectiveRecord() const

Definition EditedSource.h:80

bool canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs)

void applyRewrites(EditsReceiver &receiver, bool adjustRemovals=true)

bool commit(const Commit &commit)

EditedSource(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)

Definition EditedSource.h:73

const SourceManager & getSourceManager() const

Definition EditedSource.h:77

The JSON file list parser is used to communicate input to InstallAPI.

bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)

@ Other

Other implicit parameter.