|
16 | 16 |
|
17 | 17 | import cpp |
18 | 18 | import codingstandards.cpp.autosar |
19 | | -import codingstandards.cpp.Naming |
| 19 | +import codingstandards.cpp.StandardLibraryNames |
20 | 20 |
|
21 | | -from Locatable l, string s, string t |
| 21 | +module TargetedCLibrary = CStandardLibrary::C99; |
| 22 | + |
| 23 | +module TargetedCppLibrary = CppStandardLibrary::Cpp14; |
| 24 | + |
| 25 | +from Locatable l, string s, string t, string header, string standard |
22 | 26 | where |
23 | 27 | not isExcluded(l, NamingPackage::nameOfStandardLibraryMacroOrObjectReusedQuery()) and |
24 | 28 | l.fromSource() and |
|
28 | 32 | s = l.(GlobalOrNamespaceVariable).getName() and t = "Object" |
29 | 33 | ) and |
30 | 34 | ( |
31 | | - Naming::Cpp14::hasStandardLibraryMacroName(s) |
| 35 | + standard = TargetedCppLibrary::getName() and |
| 36 | + ( |
| 37 | + TargetedCppLibrary::hasMacroName(header, s, _) |
| 38 | + or |
| 39 | + TargetedCppLibrary::hasObjectName(header, _, s, _, _) |
| 40 | + ) |
32 | 41 | or |
33 | | - Naming::Cpp14::hasStandardLibraryObjectName(s) |
| 42 | + standard = TargetedCLibrary::getName() and |
| 43 | + ( |
| 44 | + header = max(string candidateHeader | TargetedCLibrary::hasMacroName(candidateHeader, s, _)) |
| 45 | + or |
| 46 | + header = |
| 47 | + max(string candidateHeader | TargetedCLibrary::hasObjectName(candidateHeader, _, s, _, _)) |
| 48 | + ) |
34 | 49 | ) |
35 | | -select l, t + " reuses the name " + s + " from the standard library." |
| 50 | +select l, |
| 51 | + t + " reuses the name " + s + " from the " + standard + " standard library header <" + header + |
| 52 | + ">." |
0 commit comments