diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2018-03-27 00:01:49 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2018-03-27 00:01:49 +0000 |
commit | f06173045da016eb4a580be2a85da52a087ff72a (patch) | |
tree | 31a14887a36d13bf6b08ef41918272cf51248444 /include/clang/Edit/EditedSource.h | |
parent | a21970a87881c94771038020ed3aaae39d39fe4e (diff) | |
download | clang-f06173045da016eb4a580be2a85da52a087ff72a.tar.gz |
[Edit, Rewrite] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Edit/EditedSource.h')
-rw-r--r-- | include/clang/Edit/EditedSource.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/include/clang/Edit/EditedSource.h b/include/clang/Edit/EditedSource.h index d95a0c2be8..3d33688f5f 100644 --- a/include/clang/Edit/EditedSource.h +++ b/include/clang/Edit/EditedSource.h @@ -1,4 +1,4 @@ -//===----- EditedSource.h - Collection of source edits ----------*- C++ -*-===// +//===- EditedSource.h - Collection of source edits --------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,21 +11,27 @@ #define LLVM_CLANG_EDIT_EDITEDSOURCE_H #include "clang/Basic/IdentifierTable.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Edit/FileOffset.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/TinyPtrVector.h" #include "llvm/Support/Allocator.h" #include <map> #include <tuple> +#include <utility> namespace clang { - class LangOptions; - class PPConditionalDirectiveRecord; + +class LangOptions; +class PPConditionalDirectiveRecord; +class SourceManager; namespace edit { - class Commit; - class EditsReceiver; + +class Commit; +class EditsReceiver; class EditedSource { const SourceManager &SourceMgr; @@ -34,17 +40,19 @@ class EditedSource { struct FileEdit { StringRef Text; - unsigned RemoveLen; + unsigned RemoveLen = 0; - FileEdit() : RemoveLen(0) {} + FileEdit() = default; }; - typedef std::map<FileOffset, FileEdit> FileEditsTy; + using FileEditsTy = std::map<FileOffset, FileEdit>; + FileEditsTy FileEdits; struct MacroArgUse { IdentifierInfo *Identifier; SourceLocation ImmediateExpansionLoc; + // Location of argument use inside the top-level macro SourceLocation UseLoc; @@ -65,11 +73,11 @@ class EditedSource { public: EditedSource(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec = nullptr) - : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts), - StrAlloc() { } + : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts) {} const SourceManager &getSourceManager() const { return SourceMgr; } const LangOptions &getLangOpts() const { return LangOpts; } + const PPConditionalDirectiveRecord *getPPCondDirectiveRecord() const { return PPRec; } @@ -103,8 +111,8 @@ private: void finishedCommit(); }; -} +} // namespace edit -} // end namespace clang +} // namespace clang -#endif +#endif // LLVM_CLANG_EDIT_EDITEDSOURCE_H |