diff --git a/c/misra/src/codingstandards/c/misra/EssentialTypes.qll b/c/misra/src/codingstandards/c/misra/EssentialTypes.qll index 697a24513f..930e7300b7 100644 --- a/c/misra/src/codingstandards/c/misra/EssentialTypes.qll +++ b/c/misra/src/codingstandards/c/misra/EssentialTypes.qll @@ -365,12 +365,12 @@ predicate isAssignmentToEssentialType(Type lValueEssentialType, Expr rValue) { // Initializing an array exists(ArrayAggregateLiteral aal | lValueEssentialType = aal.getElementType() and - rValue = aal.getElementExpr(_) + rValue = aal.getAnElementExpr(_) ) or // Initializing a struct or union exists(ClassAggregateLiteral cal, Field field | lValueEssentialType = field.getType() and - rValue = cal.getFieldExpr(field) + rValue = cal.getAFieldExpr(field) ) } diff --git a/cpp/autosar/src/rules/A12-1-5/InitializerHashCons.qll b/cpp/autosar/src/rules/A12-1-5/InitializerHashCons.qll index b1e1bc03f4..bc63c253fa 100644 --- a/cpp/autosar/src/rules/A12-1-5/InitializerHashCons.qll +++ b/cpp/autosar/src/rules/A12-1-5/InitializerHashCons.qll @@ -891,7 +891,7 @@ private predicate mk_FieldCons( analyzableClassAggregateLiteral(cal) and cal.getUnspecifiedType() = c and exists(Expr e | - e = cal.getFieldExpr(f).getFullyConverted() and + e = cal.getAFieldExpr(f).getFullyConverted() and f.getInitializationOrder() = i and ( hc = hashCons(e) and @@ -907,9 +907,9 @@ private predicate mk_FieldCons( private predicate analyzableClassAggregateLiteral(ClassAggregateLiteral cal) { forall(int i | exists(cal.getChild(i)) | strictcount(cal.getChild(i).getFullyConverted()) = 1 and - strictcount(Field f | cal.getChild(i) = cal.getFieldExpr(f)) = 1 and + strictcount(Field f | cal.getChild(i) = cal.getAFieldExpr(f)) = 1 and strictcount(Field f, int j | - cal.getFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() + cal.getAFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() ) = 1 ) } diff --git a/cpp/autosar/src/rules/A5-1-9/LambdaEquivalence.qll b/cpp/autosar/src/rules/A5-1-9/LambdaEquivalence.qll index 110c7c734d..040777e321 100644 --- a/cpp/autosar/src/rules/A5-1-9/LambdaEquivalence.qll +++ b/cpp/autosar/src/rules/A5-1-9/LambdaEquivalence.qll @@ -989,7 +989,7 @@ private module HashCons { analyzableClassAggregateLiteral(cal) and cal.getUnspecifiedType() = c and exists(Expr e | - e = cal.getFieldExpr(f).getFullyConverted() and + e = cal.getAFieldExpr(f).getFullyConverted() and f.getInitializationOrder() = i and ( hc = hashConsExpr(e) and @@ -1005,9 +1005,9 @@ private module HashCons { private predicate analyzableClassAggregateLiteral(ClassAggregateLiteral cal) { forall(int i | exists(cal.getChild(i)) | strictcount(cal.getChild(i).getFullyConverted()) = 1 and - strictcount(Field f | cal.getChild(i) = cal.getFieldExpr(f)) = 1 and + strictcount(Field f | cal.getChild(i) = cal.getAFieldExpr(f)) = 1 and strictcount(Field f, int j | - cal.getFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() + cal.getAFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() ) = 1 ) } diff --git a/cpp/common/src/codingstandards/cpp/StructuralEquivalence.qll b/cpp/common/src/codingstandards/cpp/StructuralEquivalence.qll index 3423134ca1..0fbc5ce8e7 100644 --- a/cpp/common/src/codingstandards/cpp/StructuralEquivalence.qll +++ b/cpp/common/src/codingstandards/cpp/StructuralEquivalence.qll @@ -989,7 +989,7 @@ private module HashCons { analyzableClassAggregateLiteral(cal) and cal.getUnspecifiedType() = c and exists(Expr e | - e = cal.getFieldExpr(f).getFullyConverted() and + e = cal.getAFieldExpr(f).getFullyConverted() and f.getInitializationOrder() = i and ( hc = hashConsExpr(e) and @@ -1005,9 +1005,9 @@ private module HashCons { private predicate analyzableClassAggregateLiteral(ClassAggregateLiteral cal) { forall(int i | exists(cal.getChild(i)) | strictcount(cal.getChild(i).getFullyConverted()) = 1 and - strictcount(Field f | cal.getChild(i) = cal.getFieldExpr(f)) = 1 and + strictcount(Field f | cal.getChild(i) = cal.getAFieldExpr(f)) = 1 and strictcount(Field f, int j | - cal.getFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() + cal.getAFieldExpr(f) = cal.getChild(i) and j = f.getInitializationOrder() ) = 1 ) } diff --git a/cpp/common/src/codingstandards/cpp/enhancements/AggregateLiteralEnhancements.qll b/cpp/common/src/codingstandards/cpp/enhancements/AggregateLiteralEnhancements.qll index 4d80fc16a2..0c34f661e2 100644 --- a/cpp/common/src/codingstandards/cpp/enhancements/AggregateLiteralEnhancements.qll +++ b/cpp/common/src/codingstandards/cpp/enhancements/AggregateLiteralEnhancements.qll @@ -114,7 +114,7 @@ module ClassAggregateLiterals { exists(Expr compilerGeneratedVal, int index, Expr previousExpr | // Identify the candidate expression which may be compiler generated compilerGeneratedVal = cal.getChild(index) and - compilerGeneratedVal = cal.getFieldExpr(f) and + compilerGeneratedVal = cal.getAFieldExpr(f) and // Find the previous expression for this aggregate literal previousExpr = getPreviousExpr(cal, index) | @@ -201,7 +201,7 @@ class InferredAggregateLiteral extends AggregateLiteral { predicate isExprValueInitialized(AggregateLiteral al, Expr e) { // This expression is a value initialized field exists(Field f | - e = al.(ClassAggregateLiteral).getFieldExpr(f) and + e = al.(ClassAggregateLiteral).getAFieldExpr(f) and ClassAggregateLiterals::isValueInitialized(al, f) ) or @@ -236,7 +236,7 @@ predicate isLeadingZeroInitialized(AggregateLiteral a) { // Or because it's a class aggregate, and all other fields are value initialized forall(Field f | f = a.getType().(Class).getAField() and - not a.(ClassAggregateLiteral).getFieldExpr(f) = a.getChild(0) + not a.(ClassAggregateLiteral).getAFieldExpr(f) = a.getChild(0) | ClassAggregateLiterals::isValueInitialized(a, f) ) diff --git a/cpp/common/src/codingstandards/cpp/rules/useinitializerbracestomatchaggregatetypestructure/UseInitializerBracesToMatchAggregateTypeStructure.qll b/cpp/common/src/codingstandards/cpp/rules/useinitializerbracestomatchaggregatetypestructure/UseInitializerBracesToMatchAggregateTypeStructure.qll index 8aab8849fd..d81670b558 100644 --- a/cpp/common/src/codingstandards/cpp/rules/useinitializerbracestomatchaggregatetypestructure/UseInitializerBracesToMatchAggregateTypeStructure.qll +++ b/cpp/common/src/codingstandards/cpp/rules/useinitializerbracestomatchaggregatetypestructure/UseInitializerBracesToMatchAggregateTypeStructure.qll @@ -28,7 +28,7 @@ query predicate problems( exists(string parentDescription | // For class aggergate literal parents, report which field is being assigned to exists(ClassAggregateLiteral cal, Field field | - cal.getFieldExpr(field) = inferredAggregateLiteral and + cal.getAFieldExpr(field) = inferredAggregateLiteral and parentDescription = "to field $@" and explanationElement = field | @@ -37,15 +37,15 @@ query predicate problems( or // For array aggregate literal parents, report which index is being assigned to exists(ArrayAggregateLiteral aal, int elementIndex | - aal.getElementExpr(elementIndex) = inferredAggregateLiteral and + aal.getAnElementExpr(elementIndex) = inferredAggregateLiteral and parentDescription = "to index " + elementIndex + " in $@" and explanationElement = aal and explanationDescription = "array of type " + aal.getType().getName() ) or // In some cases, we seem to have missing link, so provide a basic message - not any(ArrayAggregateLiteral aal).getElementExpr(_) = inferredAggregateLiteral and - not any(ClassAggregateLiteral aal).getFieldExpr(_) = inferredAggregateLiteral and + not any(ArrayAggregateLiteral aal).getAnElementExpr(_) = inferredAggregateLiteral and + not any(ClassAggregateLiteral aal).getAFieldExpr(_) = inferredAggregateLiteral and parentDescription = "to an unnamed field of $@" and explanationElement = inferredAggregateLiteral.getParent() and explanationDescription = " " + explanationElement.(Expr).getType().getName()