diff options
author | David L. Jones <dlj@google.com> | 2017-11-10 01:07:01 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2017-11-10 01:07:01 +0000 |
commit | 41af1698c520ea38edf83e7c91f1e519d34f20c1 (patch) | |
tree | 05c516cb7514d80a5e8deccb07cd0f7c228b70d4 /include/clang/Edit | |
parent | cd1b175aa96d9d675c09fc54dfd96ba41e3f2279 (diff) | |
parent | 4d085086c74a8fbce197f61548f488a63f300933 (diff) |
Creating branches/google/testing and tags/google/testing/ from r317203
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/testing@317856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Edit')
-rw-r--r-- | include/clang/Edit/EditedSource.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/clang/Edit/EditedSource.h b/include/clang/Edit/EditedSource.h index b6ec8b8f06..d95a0c2be8 100644 --- a/include/clang/Edit/EditedSource.h +++ b/include/clang/Edit/EditedSource.h @@ -17,6 +17,7 @@ #include "llvm/ADT/TinyPtrVector.h" #include "llvm/Support/Allocator.h" #include <map> +#include <tuple> namespace clang { class LangOptions; @@ -41,9 +42,21 @@ class EditedSource { typedef std::map<FileOffset, FileEdit> FileEditsTy; FileEditsTy FileEdits; - llvm::DenseMap<unsigned, llvm::TinyPtrVector<IdentifierInfo*>> - ExpansionToArgMap; - SmallVector<std::pair<SourceLocation, IdentifierInfo*>, 2> + struct MacroArgUse { + IdentifierInfo *Identifier; + SourceLocation ImmediateExpansionLoc; + // Location of argument use inside the top-level macro + SourceLocation UseLoc; + + bool operator==(const MacroArgUse &Other) const { + return std::tie(Identifier, ImmediateExpansionLoc, UseLoc) == + std::tie(Other.Identifier, Other.ImmediateExpansionLoc, + Other.UseLoc); + } + }; + + llvm::DenseMap<unsigned, SmallVector<MacroArgUse, 2>> ExpansionToArgMap; + SmallVector<std::pair<SourceLocation, MacroArgUse>, 2> CurrCommitMacroArgExps; IdentifierTable IdentTable; @@ -65,7 +78,7 @@ public: bool commit(const Commit &commit); - void applyRewrites(EditsReceiver &receiver); + void applyRewrites(EditsReceiver &receiver, bool adjustRemovals = true); void clearRewrites(); StringRef copyString(StringRef str) { return str.copy(StrAlloc); } @@ -84,7 +97,7 @@ private: FileEditsTy::iterator getActionForOffset(FileOffset Offs); void deconstructMacroArgLoc(SourceLocation Loc, SourceLocation &ExpansionLoc, - IdentifierInfo *&II); + MacroArgUse &ArgUse); void startingCommit(); void finishedCommit(); |