diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2013-10-11 17:35:22 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-10-11 17:35:22 +0000 |
| commit | 1d27ffd6978b73f25b800097c517db768eb53cc0 (patch) | |
| tree | f14e9e92df0ae812416268243900e159c6b39e18 /clang/lib/ARCMigrate/Transforms.cpp | |
| parent | 795d2b9f95f2880b9e91d2521518d890a71673d2 (diff) | |
| download | bcm5719-llvm-1d27ffd6978b73f25b800097c517db768eb53cc0.tar.gz bcm5719-llvm-1d27ffd6978b73f25b800097c517db768eb53cc0.zip | |
ObjectiveC migrator: fixes a bug when in NS_ENUM/NS_OPTIONS
migration, the typedef has annotations.
// rdar://15200602
llvm-svn: 192468
Diffstat (limited to 'clang/lib/ARCMigrate/Transforms.cpp')
| -rw-r--r-- | clang/lib/ARCMigrate/Transforms.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/ARCMigrate/Transforms.cpp b/clang/lib/ARCMigrate/Transforms.cpp index 38f30a56f4a..679b924ba00 100644 --- a/clang/lib/ARCMigrate/Transforms.cpp +++ b/clang/lib/ARCMigrate/Transforms.cpp @@ -122,8 +122,8 @@ bool trans::isPlusOne(const Expr *E) { /// If no semicolon is found or the location is inside a macro, the returned /// source location will be invalid. SourceLocation trans::findLocationAfterSemi(SourceLocation loc, - ASTContext &Ctx) { - SourceLocation SemiLoc = findSemiAfterLocation(loc, Ctx); + ASTContext &Ctx, bool IsDecl) { + SourceLocation SemiLoc = findSemiAfterLocation(loc, Ctx, IsDecl); if (SemiLoc.isInvalid()) return SourceLocation(); return SemiLoc.getLocWithOffset(1); @@ -134,7 +134,8 @@ SourceLocation trans::findLocationAfterSemi(SourceLocation loc, /// If no semicolon is found or the location is inside a macro, the returned /// source location will be invalid. SourceLocation trans::findSemiAfterLocation(SourceLocation loc, - ASTContext &Ctx) { + ASTContext &Ctx, + bool IsDecl) { SourceManager &SM = Ctx.getSourceManager(); if (loc.isMacroID()) { if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOpts(), &loc)) @@ -159,8 +160,13 @@ SourceLocation trans::findSemiAfterLocation(SourceLocation loc, file.begin(), tokenBegin, file.end()); Token tok; lexer.LexFromRawLexer(tok); - if (tok.isNot(tok::semi)) - return SourceLocation(); + if (tok.isNot(tok::semi)) { + if (!IsDecl) + return SourceLocation(); + // Declaration may be followed with other tokens; such as an __attribute, + // before ending with a semicolon. + return findSemiAfterLocation(tok.getLocation(), Ctx, /*IsDecl*/true); + } return tok.getLocation(); } |

