[PATCH] D93094: [clang][cli] Prevent double denormalization

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 11 14:11:39 PST 2020


dexonsmith added inline comments.


================
Comment at: clang/unittests/Frontend/CompilerInvocationTest.cpp:267
 
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdebug-pass-manager")));
+  ASSERT_EQ(count(GeneratedArgs, "-fdebug-pass-manager"), 1);
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-debug-pass-manager"))));
----------------
jansvoboda11 wrote:
> Is it wise to rely on pointer comparison here? The call to `count` returns 2 before changing the denormalizer and 1 after, but I'm not sure if it will work on all platforms.
Does this compile / avoid the pointer comparison?
```
ASSERT_EQ(count(GeneratedArgs, StringRef("-fdebug-pass-manager")), 1);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93094



More information about the cfe-commits mailing list