-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from goblint/show-cfg
Show CFGs for functions in the IDE
- Loading branch information
Showing
19 changed files
with
661 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package analysis; | ||
|
||
import com.ibm.wala.cast.tree.CAstSourcePositionMap; | ||
import com.ibm.wala.util.collections.Pair; | ||
import magpiebridge.core.AnalysisResult; | ||
import magpiebridge.core.Kind; | ||
import org.eclipse.lsp4j.Command; | ||
import org.eclipse.lsp4j.DiagnosticSeverity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
|
||
/** | ||
* The Class GoblintCFGAnalysisResult. | ||
* <p> | ||
* Implementation of the GoblintAnalysisResult class that extends MagpieBridge AnalysisResult class. | ||
* The class that corresponds to the CFG code lenses. | ||
* | ||
* @author Karoliine Holter | ||
* @since 0.0.3 | ||
*/ | ||
|
||
public class GoblintCFGAnalysisResult implements AnalysisResult { | ||
private final CAstSourcePositionMap.Position pos; | ||
private final String funName; | ||
private final String fileName; | ||
private final Iterable<Pair<CAstSourcePositionMap.Position, String>> related = new ArrayList<>(); | ||
|
||
public GoblintCFGAnalysisResult(CAstSourcePositionMap.Position pos, String funName, String fileName) { | ||
this.pos = pos; | ||
this.funName = funName; | ||
this.fileName = fileName; | ||
} | ||
|
||
@Override | ||
public Iterable<Command> command() { | ||
Command command = new Command("show cfg", "showcfg", Collections.singletonList(funName)); | ||
return Collections.singleton(command); | ||
} | ||
|
||
@Override | ||
public Kind kind() { | ||
return Kind.CodeLens; | ||
} | ||
|
||
@Override | ||
public String toString(boolean useMarkdown) { | ||
return "cfg"; | ||
} | ||
|
||
@Override | ||
public CAstSourcePositionMap.Position position() { | ||
return pos; | ||
} | ||
|
||
@Override | ||
public Iterable<Pair<CAstSourcePositionMap.Position, String>> related() { | ||
return related; | ||
} | ||
|
||
@Override | ||
public DiagnosticSeverity severity() { | ||
return DiagnosticSeverity.Information; | ||
} | ||
|
||
@Override | ||
public Pair<CAstSourcePositionMap.Position, String> repair() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String code() { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.