Standardize the reader methods in ASTReader; NFC.
authorJohn McCall <rjmccall@apple.com>
Fri, 13 Dec 2019 08:37:23 +0000 (03:37 -0500)
committerJohn McCall <rjmccall@apple.com>
Sat, 14 Dec 2019 05:16:48 +0000 (00:16 -0500)
commit3ce3d23facf146698c4ef6107d1b9425b3ff5764
treed607d66c351b4ed2e1833e376ae43590e220479a
parent139006ceb641f038a2b19cac1174316e57004ed6
Standardize the reader methods in ASTReader; NFC.

There are three significant changes here:

- Most of the methods to read various embedded structures (`APInt`,
  `NestedNameSpecifier`, `DeclarationName`, etc.) have been moved
  from `ASTReader` to `ASTRecordReader`.  This cleans up quite a
  bit of code which was passing around `(F, Record, Idx)` arguments
  everywhere or doing explicit indexing, and it nicely parallels
  how it works on the writer side.  It also sets us up to then move
  most of these methods into the `BasicReader`s that I'm introducing
  as part of abstract serialization.

  As part of this, several of the top-level reader methods (e.g.
  `readTypeRecord`) have been converted to use `ASTRecordReader`
  internally, which is a nice readability improvement.

- I've standardized most of these method names on `readFoo` rather
  than `ReadFoo` (used in some of the helper structures) or `GetFoo`
  (used for some specific types for no apparent reason).

- I've changed a few of these methods to return their result instead
  of reading into an argument passed by reference.  This is partly
  for general consistency and partly because it will make the
  metaprogramming easier with abstract serialization.
clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp