secure-software-engineering / phasar

A LLVM-based static analysis framework.
Other
919 stars 140 forks source link

How to define `LLVMBasedICFG` #696

Closed Mohannadcse closed 6 months ago

Mohannadcse commented 6 months ago

Bug description

Seems there is inconsistency in how to define the constructor LLVMBasedICFG. How implementation indicates 3 versions of the constructor. The most widely used one is the following

LLVMBasedICFG(LLVMProjectIRDB *IRDB,
                             CallGraphAnalysisType CGType,
                             llvm::ArrayRef<std::string> EntryPoints,
                             LLVMTypeHierarchy *TH, LLVMAliasInfoRef PT,
                             Soundness S, bool IncludeGlobals)

However, this constructor is defined differently in various locations. For example:

LLVMBasedICFG ICFG(&IRDB, CallGraphAnalysisType::OTF, {"main"}, &TH, &PT, Soundness::Soundy, /IncludeGlobals/ true);

- `LLVMAliasSetTest.cpp`

LLVMAliasSet PTS(&IRDB, false); LLVMTypeHierarchy TH(IRDB); LLVMBasedICFG ICF(&IRDB, CallGraphAnalysisType::OTF, {"main"}, &TH, &PTS);


Not sure if I'm missing anything, 
fabianbs96 commented 6 months ago

Hi @Mohannadcse,

the LLVMAliasInfoRef is a type-erased type that can be constructed from a pointer to any object that provides the required interface. LLVMAliasSet is the most commonly used type that implements the AliasInfo interface, so you can view an LLVMAliasInfoRef as sth similar to a pointer-to-base for LLVMAliasSet. The type-erased type is defined here.

Does this answer your question?

Mohannadcse commented 6 months ago

@fabianbs96 thanks for the clarification.