This is an archive of the discontinued LLVM Phabricator instance.

Use lexing mode based on FormatStyle.Standard.
ClosedPublic

Authored by alexfh on Jun 22 2013, 4:55 PM.

Details

Summary

Some valid pre-C++11 constructs change meaning when lexed in C++11
mode, e.g.
#define x(_a) printf("foo"_a);
(example from http://llvm.org/bugs/show_bug.cgi?id=16342). "foo"_a is treated as
a user-defined string literal when parsed in C++11 mode.
In order to deal with this correctly, we need to set lexing mode according to
which standard the code conforms to. We already have a configuration value for
this (FormatStyle.Standard), which seems to be appropriate to use in this case
as well.

Diff Detail

Event Timeline

gribozavr added inline comments.Jun 22 2013, 5:16 PM
include/clang/Format/Format.h
222 ↗(On Diff #2539)

\param Standard

alexfh updated this revision to Unknown Object (????).Jun 22 2013, 5:44 PM

\p -> \param

include/clang/Format/Format.h
222 ↗(On Diff #2539)

Done.

alexfh closed this revision.Jun 28 2013, 5:54 AM

Closed by commit rL185149 (authored by @alexfh).