[PATCH] D55552: [Sema] Better static assert diagnostics for expressions involving temporaries.

Clement Courbet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 20 01:08:03 PST 2018


courbet added a comment.

Thanks for the comments !



================
Comment at: include/clang/AST/Type.h:995
   void getAsStringInternal(std::string &Str,
-                           const PrintingPolicy &Policy) const {
-    return getAsStringInternal(split(), Str, Policy);
-  }
+                           const PrintingPolicy &Policy) const;
 
----------------
Quuxplusone wrote:
> Nit: could this function have been left in-line, and just changed `split()` to `splitAccordingToPolicy(this, Policy)`?
> Even simpler, could `splitAccordingToPolicy` be made a member function of `QualType`, so that most of these diffs could be simply `s/split()/splitAccordingToPolicy(Policy)/` without introducing any new temporary variables or anything?  I.e.
> ```
>     void getAsStringInternal(std::string &Str,
>                               const PrintingPolicy &Policy) const {
>         return getAsStringInternal(splitAccordingToPolicy(Policy), Str, Policy);
>     }
> ```
> But if that would make the code harder to read instead of easier, then don't mind me.
I'd rather avoid polluting the `QualType` API with `splitAccordingToPolicy()` which is really only useful for this use case.

>  without introducing any new temporary variables or anything? i.e.

Actually this is independent of the above change, done.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55552





More information about the cfe-commits mailing list