[llvm-branch-commits] [cfe-branch] r196075 - Merging r196048:

Bill Wendling isanbard at gmail.com
Sun Dec 1 23:38:30 PST 2013


Author: void
Date: Mon Dec  2 01:38:30 2013
New Revision: 196075

URL: http://llvm.org/viewvc/llvm-project?rev=196075&view=rev
Log:
Merging r196048:
------------------------------------------------------------------------
r196048 | d0k | 2013-12-01 07:09:32 -0800 (Sun, 01 Dec 2013) | 3 lines

CommentLexer: When proceeding with a typo corrected name don't clobber the token.

This would crash if the token is used in another diagnostic. PR18051.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/AST/CommentLexer.cpp
    cfe/branches/release_34/test/Sema/warn-documentation-fixits.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec  2 01:38:30 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195669,195687,195693,195710,195713,195716,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196050
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195669,195687,195693,195710,195713,195716,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/AST/CommentLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/AST/CommentLexer.cpp?rev=196075&r1=196074&r2=196075&view=diff
==============================================================================
--- cfe/branches/release_34/lib/AST/CommentLexer.cpp (original)
+++ cfe/branches/release_34/lib/AST/CommentLexer.cpp Mon Dec  2 01:38:30 2013
@@ -353,16 +353,17 @@ void Lexer::lexCommentText(Token &T) {
 
         const CommandInfo *Info = Traits.getCommandInfoOrNULL(CommandName);
         if (!Info) {
-          formTokenWithChars(T, TokenPtr, tok::unknown_command);
-          T.setUnknownCommandName(CommandName);
           if ((Info = Traits.getTypoCorrectCommandInfo(CommandName))) {
             StringRef CorrectedName = Info->Name;
-            SourceRange CommandRange(T.getLocation().getLocWithOffset(1),
-                                     T.getEndLocation());
-            Diag(T.getLocation(), diag::warn_correct_comment_command_name)
+            SourceLocation Loc = getSourceLocation(BufferPtr);
+            SourceRange CommandRange(Loc.getLocWithOffset(1),
+                                     getSourceLocation(TokenPtr));
+            Diag(Loc, diag::warn_correct_comment_command_name)
               << CommandName << CorrectedName
               << FixItHint::CreateReplacement(CommandRange, CorrectedName);
           } else {
+            formTokenWithChars(T, TokenPtr, tok::unknown_command);
+            T.setUnknownCommandName(CommandName);
             Diag(T.getLocation(), diag::warn_unknown_comment_command_name);
             return;
           }

Modified: cfe/branches/release_34/test/Sema/warn-documentation-fixits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/Sema/warn-documentation-fixits.cpp?rev=196075&r1=196074&r2=196075&view=diff
==============================================================================
--- cfe/branches/release_34/test/Sema/warn-documentation-fixits.cpp (original)
+++ cfe/branches/release_34/test/Sema/warn-documentation-fixits.cpp Mon Dec  2 01:38:30 2013
@@ -70,6 +70,11 @@ int gorf();
 /// \t bbb IS_DOXYGEN_END
 int Bar();
 
+// expected-warning at +2  {{unknown command tag name 'encode'; did you mean 'endcode'?}}
+// expected-warning at +1  {{'\endcode' command does not terminate a verbatim text block}}
+/// \encode PR18051
+int PR18051();
+
 // CHECK: fix-it:"{{.*}}":{5:12-5:22}:"a"
 // CHECK: fix-it:"{{.*}}":{9:12-9:15}:"aaa"
 // CHECK: fix-it:"{{.*}}":{13:13-13:23}:"T"
@@ -83,3 +88,4 @@ int Bar();
 // CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED"
 // CHECK: fix-it:"{{.*}}":{63:6-63:11}:"return"
 // CHECK: fix-it:"{{.*}}":{67:6-67:11}:"foobar"
+// CHECK: fix-it:"{{.*}}":{75:6-75:12}:"endcode"





More information about the llvm-branch-commits mailing list