[cfe-commits] r139087 - in /cfe/trunk: lib/Lex/MacroArgs.cpp test/Index/complete-in-stringify.c
Erik Verbruggen
erikjv at me.com
Sun Sep 4 00:41:03 PDT 2011
Thank you for fixing this :)
On 4 sep. 2011, at 05:32, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Author: akirtzidis
> Date: Sat Sep 3 22:32:19 2011
> New Revision: 139087
>
> URL: http://llvm.org/viewvc/llvm-project?rev=139087&view=rev
> Log:
> Handle a code-completion token being passed to the macro stringify operator.
> Fixes http://llvm.org/PR10826.
>
> Added:
> cfe/trunk/test/Index/complete-in-stringify.c
> Modified:
> cfe/trunk/lib/Lex/MacroArgs.cpp
>
> Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=139087&r1=139086&r2=139087&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
> +++ cfe/trunk/lib/Lex/MacroArgs.cpp Sat Sep 3 22:32:19 2011
> @@ -221,6 +221,8 @@
> std::string Str = Lexer::Stringify(TokStr);
> Result.append(Str.begin(), Str.end());
> }
> + } else if (Tok.is(tok::code_completion)) {
> + PP.CodeCompleteNaturalLanguage();
> } else {
> // Otherwise, just append the token. Do some gymnastics to get the token
> // in place and avoid copies where possible.
>
> Added: cfe/trunk/test/Index/complete-in-stringify.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-in-stringify.c?rev=139087&view=auto
> ==============================================================================
> --- cfe/trunk/test/Index/complete-in-stringify.c (added)
> +++ cfe/trunk/test/Index/complete-in-stringify.c Sat Sep 3 22:32:19 2011
> @@ -0,0 +1,17 @@
> +const char *func(const char *);
> +
> +#define MORE __FILE__
> +
> +#define M(x) "1"#x
> +#define N(x) func("2"#x MORE)
> +
> +void foo(const char *);
> +
> +int test() {
> + foo(M(x()));
> + foo(N(x()));
> +}
> +
> +// RUN: c-index-test -code-completion-at=%s:11:11 %s | FileCheck %s
> +// RUN: c-index-test -code-completion-at=%s:12:11 %s | FileCheck %s
> +// CHECK: Natural language
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list