souffle  2.0.2-371-g6315b36
PolymorphicObjects.cpp
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2020, The Souffle Developers. All rights reserved.
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file PolymorphicObjects.cpp
12  *
13  ***********************************************************************/
14 
16 #include "ast/Aggregator.h"
17 #include "ast/BinaryConstraint.h"
18 #include "ast/IntrinsicFunctor.h"
19 #include "ast/NumericConstant.h"
20 #include "ast/TranslationUnit.h"
21 #include "ast/utility/Visitor.h"
23 
24 namespace souffle::ast::analysis {
25 
26 void PolymorphicObjectsAnalysis::run(const TranslationUnit& translationUnit) {
27  typeAnalysis = translationUnit.getAnalysis<analysis::TypeAnalysis>();
28 }
29 
30 void PolymorphicObjectsAnalysis::print(std::ostream& /* os */) const {}
31 
34 }
35 
38 }
39 
41  return !typeAnalysis->hasValidTypeInfo(nc);
42 }
43 
46 }
47 
50 }
51 
52 } // namespace souffle::ast::analysis
TranslationUnit.h
souffle::ast::analysis::PolymorphicObjectsAnalysis::getInferredType
NumericConstant::Type getInferredType(const NumericConstant *nc) const
Definition: PolymorphicObjects.cpp:40
souffle::ast::analysis::PolymorphicObjectsAnalysis::typeAnalysis
const TypeAnalysis * typeAnalysis
Definition: PolymorphicObjects.h:63
souffle::ast::analysis::TypeAnalysis::getPolymorphicOperator
AggregateOp getPolymorphicOperator(const Aggregator *agg) const
Definition: Type.cpp:278
souffle::ast::analysis::TypeAnalysis::getPolymorphicNumericConstantType
NumericConstant::Type getPolymorphicNumericConstantType(const NumericConstant *nc) const
– Polymorphism-related methods –
Definition: Type.cpp:268
souffle::AggregateOp
AggregateOp
Types of aggregation functions.
Definition: AggregateOp.h:34
souffle::ast::analysis::PolymorphicObjectsAnalysis::getOverloadedFunctionOp
FunctorOp getOverloadedFunctionOp(const IntrinsicFunctor *inf) const
Definition: PolymorphicObjects.cpp:36
IntrinsicFunctor.h
souffle::ast::analysis::TypeAnalysis::hasValidTypeInfo
bool hasValidTypeInfo(const Argument *argument) const
Definition: Type.cpp:255
ContainerUtil.h
souffle::ast::IntrinsicFunctor
Intrinsic Functor class for functors are in-built.
Definition: IntrinsicFunctor.h:47
PolymorphicObjects.h
souffle::BinaryConstraintOp
BinaryConstraintOp
Binary Constraint Operators.
Definition: BinaryConstraintOps.h:41
souffle::ast::analysis::PolymorphicObjectsAnalysis::print
void print(std::ostream &os) const override
print the analysis result in HTML format
Definition: PolymorphicObjects.cpp:34
souffle::FunctorOp
FunctorOp
Definition: FunctorOps.h:35
souffle::ast::BinaryConstraint
Binary constraint class.
Definition: BinaryConstraint.h:53
Aggregator.h
souffle::ast::analysis::PolymorphicObjectsAnalysis::run
void run(const TranslationUnit &translationUnit) override
run analysis for a Ast translation unit
Definition: PolymorphicObjects.cpp:30
souffle::ast::Aggregator
Defines the aggregator class.
Definition: Aggregator.h:53
Visitor.h
souffle::ast::analysis
Definition: Aggregate.cpp:39
BinaryConstraint.h
souffle::ast::NumericConstant::Type
Type
Definition: NumericConstant.h:51
souffle::ast::NumericConstant
Numeric Constant.
Definition: NumericConstant.h:43
souffle::ast::analysis::PolymorphicObjectsAnalysis::getOverloadedOperator
BinaryConstraintOp getOverloadedOperator(const BinaryConstraint *bc) const
Definition: PolymorphicObjects.cpp:48
souffle::ast::analysis::PolymorphicObjectsAnalysis::hasInvalidType
bool hasInvalidType(const NumericConstant *nc) const
Definition: PolymorphicObjects.cpp:44
NumericConstant.h