[PATCH] Use 'auto' with 'new' expressions

Edwin Vane edwin.vane at intel.com
Wed Mar 27 13:05:13 PDT 2013


Hi gribozavr, klimek,

For variable declarations initialized with new expressions, use 'auto'
for the type specifier.

The 'auto' replacement happens only when the type of the VarDecl exactly
matches the type of the initializer and the VarDecl is *not*
CV-qualified. The only case that is currently handled is if the pointer
type of the VarDecl is itself CV qualified.

Some improvements need to be made to Clang's TypeLoc information in
order for other CV qualifier cases to be successfully handled. See the
new test suite new_cv_failing.cpp for examples of usages that could be
handled with such an improvement.

Function pointers are, for now, not transformed until the identifier
info can be extracted.

http://llvm-reviews.chandlerc.com/D582

Files:
  cpp11-migrate/UseAuto/UseAuto.cpp
  cpp11-migrate/UseAuto/UseAutoActions.cpp
  cpp11-migrate/UseAuto/UseAutoActions.h
  cpp11-migrate/UseAuto/UseAutoMatchers.cpp
  cpp11-migrate/UseAuto/UseAutoMatchers.h
  test/cpp11-migrate/UseAuto/new.cpp
  test/cpp11-migrate/UseAuto/new_cv_failing.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D582.1.patch
Type: text/x-patch
Size: 12644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130327/84be9445/attachment.bin>


More information about the cfe-commits mailing list