[PATCH] D87004: [analyzer] Evaluate PredefinedExpressions

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 06:42:00 PDT 2020


riccibruno added inline comments.


================
Comment at: clang/test/Analysis/eval-predefined-exprs.cpp:7-21
+  clang_analyzer_dump(__func__);
+  clang_analyzer_dump(__FUNCTION__);
+  clang_analyzer_dump(__PRETTY_FUNCTION__);
+  // expected-warning at -3 {{&Element{"func",0 S64b,char}}}
+  // expected-warning at -3 {{&Element{"func",0 S64b,char}}}
+  // expected-warning at -3 {{&Element{"void func(U) [T = Class, Value = 42, U = char]",0 S64b,char}}}
+}
----------------
steakhal wrote:
> riccibruno wrote:
> > martong wrote:
> > > martong wrote:
> > > > steakhal wrote:
> > > > > Szelethus wrote:
> > > > > > Why not put the expected warning right below the function call?
> > > > > That would seriously violate the column limit.
> > > > > This way it is easier to see and validate the pattern IMO.
> > > > This could be like:
> > > > ```
> > > > clang_analyzer_dump(__FUNCDNAME__); // \
> > > > // expected-warning at -4 {{&Element{"??$func at UClass@?1??foo@@YAXXZ@$0CK at D@@YAXD at Z",0 S64b,char}}}
> > > > clang_analyzer_dump(L__FUNCTION__); // \
> > > > // expected-warning at -4 {{&Element{L"func",0 S64b,wchar_t}}}
> > > > ...
> > > > ```
> > > > So, this way you can keep the line limit, I think this is what @Szelethus refers to.
> > > > This could be like: ...
> > > There is no need for the `@-4` of course with that approach.
> > There is no column limit in `test/`.
> Do you think it would be more readable that way? I'm still not convinced.
I have no opinion on whether it is more readable. I was just saying that `test/` is an exception to the column limit policy, and indeed that *many* tests have lines longer that the limit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87004



More information about the cfe-commits mailing list