summaryrefslogtreecommitdiffstats
path: root/clang/lib/Edit
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-02-09 23:30:07 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-02-09 23:30:07 +0000
commit441e8fdf94e628ce7fcfba6915fedb9c096b3850 (patch)
tree5e1b7dbcba18baae4a755b91ca01b412684f181b /clang/lib/Edit
parent1e871bcd188e5ec369903d8928bbf1725f149992 (diff)
downloadbcm5719-llvm-441e8fdf94e628ce7fcfba6915fedb9c096b3850.tar.gz
bcm5719-llvm-441e8fdf94e628ce7fcfba6915fedb9c096b3850.zip
[NFC] Extract method to SourceManager for traversing the macro "stack"
The code for going up the macro arg expansion is duplicated in many places (and we need it for the analyzer as well, so I did not want to duplicate it two more times). This patch is an NFC, so the semantics should remain the same. Differential Revision: https://reviews.llvm.org/D42458 llvm-svn: 324780
Diffstat (limited to 'clang/lib/Edit')
-rw-r--r--clang/lib/Edit/Commit.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Edit/Commit.cpp b/clang/lib/Edit/Commit.cpp
index cb7a784a41a..0cc152bf1e7 100644
--- a/clang/lib/Edit/Commit.cpp
+++ b/clang/lib/Edit/Commit.cpp
@@ -225,8 +225,7 @@ bool Commit::canInsert(SourceLocation loc, FileOffset &offs) {
isAtStartOfMacroExpansion(loc, &loc);
const SourceManager &SM = SourceMgr;
- while (SM.isMacroArgExpansion(loc))
- loc = SM.getImmediateSpellingLoc(loc);
+ loc = SM.getTopMacroCallerLoc(loc);
if (loc.isMacroID())
if (!isAtStartOfMacroExpansion(loc, &loc))
@@ -256,8 +255,7 @@ bool Commit::canInsertAfterToken(SourceLocation loc, FileOffset &offs,
isAtEndOfMacroExpansion(loc, &loc);
const SourceManager &SM = SourceMgr;
- while (SM.isMacroArgExpansion(loc))
- loc = SM.getImmediateSpellingLoc(loc);
+ loc = SM.getTopMacroCallerLoc(loc);
if (loc.isMacroID())
if (!isAtEndOfMacroExpansion(loc, &loc))
OpenPOWER on IntegriCloud