diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-02-09 23:30:07 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-02-09 23:30:07 +0000 |
commit | 441e8fdf94e628ce7fcfba6915fedb9c096b3850 (patch) | |
tree | 5e1b7dbcba18baae4a755b91ca01b412684f181b /clang/lib/Sema/SemaChecking.cpp | |
parent | 1e871bcd188e5ec369903d8928bbf1725f149992 (diff) | |
download | llvm-441e8fdf94e628ce7fcfba6915fedb9c096b3850.zip llvm-441e8fdf94e628ce7fcfba6915fedb9c096b3850.tar.gz llvm-441e8fdf94e628ce7fcfba6915fedb9c096b3850.tar.bz2 |
[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/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 8f6eef5..8f6fa10 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -9357,11 +9357,8 @@ static void DiagnoseNullConversion(Sema &S, Expr *E, QualType T, // Venture through the macro stacks to get to the source of macro arguments. // The new location is a better location than the complete location that was // passed in. - while (S.SourceMgr.isMacroArgExpansion(Loc)) - Loc = S.SourceMgr.getImmediateMacroCallerLoc(Loc); - - while (S.SourceMgr.isMacroArgExpansion(CC)) - CC = S.SourceMgr.getImmediateMacroCallerLoc(CC); + Loc = S.SourceMgr.getTopMacroCallerLoc(Loc); + CC = S.SourceMgr.getTopMacroCallerLoc(CC); // __null is usually wrapped in a macro. Go up a macro if that is the case. if (NullKind == Expr::NPCK_GNUNull && Loc.isMacroID()) { |