[PATCH] D56723: [CodeComplete] Propagate preferred types through parser in more cases

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 29 01:55:01 PST 2019


ilya-biryukov marked 2 inline comments as done.
ilya-biryukov added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:319-346
+class PreferredTypeBuilder::RestoreRAII {
+public:
+  RestoreRAII(RestoreRAII const &) = delete;
+  RestoreRAII &operator=(RestoreRAII const &) = delete;
+
+  explicit RestoreRAII(PreferredTypeBuilder &Builder)
+      : OldType(Builder.Type), OldLoc(Builder.ExpectedLoc), Builder(&Builder) {}
----------------
rsmith wrote:
> Now we store a location along with the expected type, I don't think we need an RAII object any more. (We would need to save/restore in tentative parsing, if we ever called any of the parsing functions that set a preferred type, but tentative parsing shouldn't be doing that.)
No RAII objects anymore. By keeping them I intended to simplify the requirements on the callers that wouldn't need to worry about restoring the expected type after parsing parts of an expression.
In practice, it's not a big burden and the resulting code looks even more concise. There are surely some cases we're missing, but it's fine, we'll track them down later and missing expected type in some cases is totally ok.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56723/new/

https://reviews.llvm.org/D56723





More information about the cfe-commits mailing list