|
16 | 16 | import cpp |
17 | 17 | import codingstandards.cpp.autosar |
18 | 18 | import codingstandards.cpp.Macro |
| 19 | +import codingstandards.cpp.CStyleCasts |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * Gets the macro (if any) that generated the given `CStyleCast`. |
@@ -61,18 +62,10 @@ Macro getGeneratedFrom(CStyleCast c) { |
61 | 62 | * argument type is compatible with a single-argument constructor. |
62 | 63 | */ |
63 | 64 |
|
64 | | -from CStyleCast c, string extraMessage, Locatable l, string supplementary |
| 65 | +from ExplicitUserDefinedCStyleCast c, string extraMessage, Locatable l, string supplementary |
65 | 66 | where |
66 | 67 | not isExcluded(c, BannedSyntaxPackage::traditionalCStyleCastsUsedQuery()) and |
67 | | - not c.isImplicit() and |
68 | | - not c.getType() instanceof UnknownType and |
69 | | - // For casts in templates that occur on types related to a template parameter, the copy of th |
70 | | - // cast in the uninstantiated template is represented as a `CStyleCast` even if in practice all |
71 | | - // the instantiations represent it as a `ConstructorCall`. To avoid the common false positive case |
72 | | - // of using the functional cast notation to call a constructor we exclude all `CStyleCast`s on |
73 | | - // uninstantiated templates, and instead rely on reporting results within instantiations. |
74 | | - not c.isFromUninstantiatedTemplate(_) and |
75 | | - // Exclude casts created from macro invocations of macros defined by third parties |
| 68 | + // Not generated from a library macro |
76 | 69 | not getGeneratedFrom(c) instanceof LibraryMacro and |
77 | 70 | // If the cast was generated from a user-provided macro, then report the macro that generated the |
78 | 71 | // cast, as the macro itself may have generated the cast |
|
0 commit comments