Class GCCSourceAnalysis

java.lang.Object
de.jplag.cpp.experimental.GCCSourceAnalysis
All Implemented Interfaces:
SourceAnalysis

public class GCCSourceAnalysis extends Object implements SourceAnalysis
Uses GCC to find unused variables and saves their location. The scanner can then check if a token belongs to an unused variable
  • Field Details

  • Constructor Details

    • GCCSourceAnalysis

      public GCCSourceAnalysis()
  • Method Details

    • isTokenIgnored

      public boolean isTokenIgnored(Token token, File file)
      Description copied from interface: SourceAnalysis
      Tells the caller if a token is located in a line containing an unused variable. This usually indicates that the token belongs to a declaration of an unused variable. An edge case is multiple variable declarations in a single line, e.g. 'int a, b;' where a is used an b is unused.
      Specified by:
      isTokenIgnored in interface SourceAnalysis
      Parameters:
      token - The token that will be checked
      file - The file the token was scanned in
      Returns:
      True, if the token should not be added to a TokenList, false if it should
    • findUnusedVariableLines

      public void findUnusedVariableLines(Set<File> files) throws InterruptedException
      Description copied from interface: SourceAnalysis
      Executes the source analysis on the files of a submission.
      Specified by:
      findUnusedVariableLines in interface SourceAnalysis
      Parameters:
      files - Set of the files contained in the submission
      Throws:
      InterruptedException