Skip to content

Commit

Permalink
vast: Replace all usages of 'analyses' to 'analysis'.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthro-poid committed Aug 12, 2024
1 parent a894a0f commit f7308ba
Showing 30 changed files with 83 additions and 84 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

Check notice on line 1 in include/vast/Analysis/Clang/CFG.hpp

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on include/vast/Analysis/Clang/CFG.hpp

File include/vast/Analysis/Clang/CFG.hpp does not conform to Custom style guidelines. (lines 5, 9, 10)

namespace vast::analyses {
namespace vast::analysis {

class CFGBlock {
public:
@@ -13,4 +13,4 @@ namespace vast::analyses {
explicit CFGBlock(unsigned blockid) : BlockID(blockid) {}
};

} // namespace vast::analyses
} // namespace vast::analysis
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@

#pragma once

#include "vast/Analyses/Clang/CFG.hpp"
#include "vast/Analysis/Clang/CFG.hpp"

#include <clang/Analysis/Analyses/IntervalPartition.h>
#include <clang/Analysis/Analyses/PostOrderCFGView.h>
#include <llvm/ADT/PriorityQueue.h>

namespace vast::analyses {
namespace vast::analysis {

/// A worklist implementation where the enqueued blocks will be dequeued based
/// on the order defined by 'Comp'.
@@ -66,4 +66,4 @@ namespace vast::analyses {
}
}
};
} // namespace vast::analyses
} // namespace vast::analysis
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ namespace vast::ast {
class StmtInterface;
}

namespace vast::analyses {
namespace vast::analysis {

class decl_interface_iterator {
mlir::Operation *Current = nullptr;
@@ -38,7 +38,7 @@ namespace vast::analyses {

template< typename SpecificDecl >
class specific_decl_interface_iterator {
using decl_interface_iterator = vast::analyses::decl_interface_iterator;
using decl_interface_iterator = vast::analysis::decl_interface_iterator;
decl_interface_iterator Current;

void SkipToNextDecl() {
@@ -95,7 +95,7 @@ namespace vast::analyses {

using ExprInterfaceIterator = CastIterator< ast::ExprInterface >;
using call_expr_arg_iterator = ExprInterfaceIterator;
} // namespace vast::analyses
} // namespace vast::analysis

namespace vast::cfg {

Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

#pragma once

#include "vast/Analyses/Iterators.hpp"
#include "vast/Analyses/Clang/CFG.hpp"
#include "vast/Analyses/Clang/FlowSensitive/DataflowWorklist.hpp"
#include "vast/Analysis/Iterators.hpp"
#include "vast/Analysis/Clang/CFG.hpp"
#include "vast/Analysis/Clang/FlowSensitive/DataflowWorklist.hpp"
#include "vast/Interfaces/CFG/CFGInterface.hpp"
#include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.hpp"
#include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.hpp"
#include "vast/Interfaces/AST/DeclInterface.hpp"
#include "vast/Interfaces/AST/TypeInterface.hpp"
#include "vast/Interfaces/AST/StmtInterface.hpp"
@@ -20,7 +20,7 @@
#include <llvm/ADT/SmallVector.h>
#include <optional>

namespace vast::analyses {
namespace vast::analysis {

/// A use of a variable, which might be uninitialized.
class UninitUse {
@@ -482,7 +482,7 @@ namespace vast::analyses {
llvm::DenseMap< ast::DeclRefExprInterface, Class > Classification;

bool isTrackedVar(ast::VarDeclInterface VD) const {
return vast::analyses::isTrackedVar(VD, DC);
return vast::analysis::isTrackedVar(VD, DC);
}

void classify(ast::ExprInterface E, Class C) {
@@ -528,7 +528,7 @@ namespace vast::analyses {
}
}

FindVarResult Var = ::vast::analyses::findVar(E, DC);
FindVarResult Var = ::vast::analysis::findVar(E, DC);
if (ast::DeclRefExprInterface DRE = Var.getDeclRefExpr()) {
Classification[DRE] = std::max(Classification[DRE], C);
}
@@ -662,11 +662,11 @@ namespace vast::analyses {
classification(classification), handler(handler) {}

bool isTrackedVar(ast::VarDeclInterface vd) {
return ::vast::analyses::isTrackedVar(vd, cast< ast::DeclContextInterface >(ac.getDecl().getOperation()));
return ::vast::analysis::isTrackedVar(vd, cast< ast::DeclContextInterface >(ac.getDecl().getOperation()));
}

FindVarResult findVar(ast::ExprInterface ex) {
return ::vast::analyses::findVar(ex, cast< ast::DeclContextInterface >(ac.getDecl().getOperation()));
return ::vast::analysis::findVar(ex, cast< ast::DeclContextInterface >(ac.getDecl().getOperation()));
}

void VisitDeclRefExpr(ast::DeclRefExprInterface dr) {
@@ -1117,4 +1117,4 @@ namespace vast::analyses {
}

UninitVariablesHandler::~UninitVariablesHandler() = default;
} // namespace vast::analyses
} // namespace vast::analysis
2 changes: 1 addition & 1 deletion include/vast/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -11,4 +11,4 @@ endif()

add_subdirectory(Tower)
add_subdirectory(Util)
add_subdirectory(Analyses)
add_subdirectory(Analysis)
2 changes: 1 addition & 1 deletion include/vast/Dialect/HighLevel/HighLevelOps.hpp
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ VAST_UNRELAX_WARNINGS
#include "vast/Interfaces/SymbolInterface.hpp"
#include "vast/Interfaces/AggregateTypeDefinitionInterface.hpp"
#include "vast/Interfaces/AST/DeclInterface.hpp"
#include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.hpp"
#include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.hpp"


namespace vast::hl
2 changes: 1 addition & 1 deletion include/vast/Dialect/HighLevel/HighLevelOps.td
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ include "vast/Dialect/HighLevel/HighLevelCF.td"
include "vast/Dialect/Core/Utils.td"
include "vast/Dialect/Core/CoreTraits.td"
include "vast/Interfaces/AST/DeclInterface.td"
include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.td"
include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.td"

include "vast/Dialect/Core/Func.td"

2 changes: 1 addition & 1 deletion include/vast/Interfaces/AST/DeclInterface.hpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ VAST_RELAX_WARNINGS
#include <mlir/IR/OperationSupport.h>
VAST_RELAX_WARNINGS

#include "vast/Analyses/Iterators.hpp"
#include "vast/Analysis/Iterators.hpp"
#include "vast/Interfaces/AST/TypeInterface.hpp"
#include "vast/Interfaces/AST/ExprInterface.hpp"
#include "vast/Interfaces/AST/ASTContextInterface.hpp"
4 changes: 2 additions & 2 deletions include/vast/Interfaces/AST/DeclInterface.td
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ def VAST_DeclContextInterface : VAST_ASTOpInterface< "DeclContextInterface" > {
let methods = [
InterfaceMethod< "clang::DeclContext::getParentASTContext",
"::vast::ast::ASTContextInterface", "getParentASTContext", (ins) >,
InterfaceMethod< "clang::DeclContext::decls_begin", "::vast::analyses::decl_interface_iterator", "decls_begin", (ins) >,
InterfaceMethod< "clang::DeclContext::decls_end", "::vast::analyses::decl_interface_iterator", "decls_end", (ins) >,
InterfaceMethod< "clang::DeclContext::decls_begin", "::vast::analysis::decl_interface_iterator", "decls_begin", (ins) >,
InterfaceMethod< "clang::DeclContext::decls_end", "::vast::analysis::decl_interface_iterator", "decls_end", (ins) >,
InterfaceMethod< "clang::DeclContext::hasExternalLexicalStorage", "bool", "hasExternalLexicalStorage" >
];
}
2 changes: 1 addition & 1 deletion include/vast/Interfaces/AST/ExprInterface.hpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ VAST_RELAX_WARNINGS
#include <mlir/IR/OperationSupport.h>
VAST_RELAX_WARNINGS

#include "vast/Analyses/Iterators.hpp"
#include "vast/Analysis/Iterators.hpp"
#include "vast/Interfaces/AST/ASTContextInterface.hpp"
#include "vast/Interfaces/AST/StmtInterface.hpp"
#include "vast/Interfaces/AST/TypeInterface.hpp"
4 changes: 2 additions & 2 deletions include/vast/Interfaces/AST/ExprInterface.td
Original file line number Diff line number Diff line change
@@ -228,8 +228,8 @@ def VAST_CallExprInterface : VAST_ASTOpInterface< "CallExprInterface",
let methods = [
InterfaceMethod< "clang::CallExpr::isCallToStdMove", "bool", "isCallToStdMove" >,
InterfaceMethod< "clang::CallExpr::getArg", "::vast::ast::ExprInterface", "getArg", (ins "unsigned":$arg) >,
InterfaceMethod< "clang::CallExpr::arg_begin", "::vast::analyses::call_expr_arg_iterator", "arg_begin" >,
InterfaceMethod< "clang::CallExpr::arg_end", "::vast::analyses::call_expr_arg_iterator", "arg_end" >
InterfaceMethod< "clang::CallExpr::arg_begin", "::vast::analysis::call_expr_arg_iterator", "arg_begin" >,
InterfaceMethod< "clang::CallExpr::arg_end", "::vast::analysis::call_expr_arg_iterator", "arg_end" >
];
}

27 changes: 0 additions & 27 deletions include/vast/Interfaces/Analyses/Common.td

This file was deleted.

Original file line number Diff line number Diff line change
@@ -16,13 +16,13 @@ VAST_RELAX_WARNINGS
#include "vast/Interfaces/CFG/CFGInterface.hpp"

/// Include the generated interface declarations.
#include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.h.inc"
#include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.h.inc"

namespace vast::analyses {
namespace vast::analysis {

template< typename T >
T *AnalysisDeclContextInterface::getAnalysis() {
return nullptr;
}

} // namespace vast::analyses
} // namespace vast::analysis
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) 2024-present, Trail of Bits, Inc.

#ifndef VAST_INTERFACES_ANALYSES_ANALYSES_DECL_CONTEXT_INTERFACE
#define VAST_INTERFACES_ANALYSES_ANALYSES_DECL_CONTEXT_INTERFACE
#ifndef VAST_INTERFACES_ANALYSIS_ANALYSIS_DECL_CONTEXT_INTERFACE
#define VAST_INTERFACES_ANALYSIS_ANALYSIS_DECL_CONTEXT_INTERFACE

include "mlir/IR/OpBase.td"
include "vast/Interfaces/Analyses/Common.td"
include "vast/Interfaces/Analysis/Common.td"

def VAST_AnalysisDeclContextInterface : VAST_AnalysesOpInterface< "AnalysisDeclContextInterface" > {
def VAST_AnalysisDeclContextInterface : VAST_AnalysisOpInterface< "AnalysisDeclContextInterface" > {

let description = [{
An interface to provide [`clang::AnalysisDeclContext`]
@@ -25,4 +25,4 @@ def VAST_AnalysisDeclContextInterface : VAST_AnalysesOpInterface< "AnalysisDeclC
}];
}

#endif // VAST_INTERFACES_ANALYSES_ANALYSES_DECL_INTERFACE
#endif // VAST_INTERFACES_ANALYSIS_ANALYSIS_DECL_INTERFACE
26 changes: 26 additions & 0 deletions include/vast/Interfaces/Analysis/Common.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2024, Trail of Bits, Inc.

#ifndef VAST_INTERFACES_ANALYSIS_COMMON
#define VAST_INTERFACES_ANALYSIS_COMMON

include "mlir/IR/OpBase.td"

class VAST_AnalysisOpInterface<string name, list<Interface> baseInterfaces = []>
: OpInterface<name, baseInterfaces>
{
let cppNamespace = "::vast::analysis";
}

class VAST_AnalysisTypeInterface<string name, list<Interface> baseInterfaces = []>
: TypeInterface<name, baseInterfaces>
{
let cppNamespace = "::vast::analysis";
}

class VAST_AnalysisAttrInterface<string name, list<Interface> baseInterfaces = []>
: AttrInterface<name, baseInterfaces>
{
let cppNamespace = "::vast::analysis";
}

#endif // VAST_INTERFACES_ANALYSIS_COMMON
2 changes: 1 addition & 1 deletion include/vast/Interfaces/CFG/CFGInterface.hpp
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ VAST_RELAX_WARNINGS
#include <mlir/IR/OperationSupport.h>
VAST_RELAX_WARNINGS

#include "vast/Analyses/Iterators.hpp"
#include "vast/Analysis/Iterators.hpp"
#include "vast/Interfaces/AST/StmtInterface.hpp"
#include <optional>

2 changes: 1 addition & 1 deletion include/vast/Interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@ add_vast_type_interface(DefaultDataLayoutTypeInterface)
add_vast_type_interface(ElementTypeInterface)

add_subdirectory(AST)
add_subdirectory(Analyses)
add_subdirectory(Analysis)
add_subdirectory(CFG)
3 changes: 0 additions & 3 deletions lib/vast/Analyses/CMakeLists.txt

This file was deleted.

3 changes: 3 additions & 0 deletions lib/vast/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_vast_library(Analysis
Iterators.cpp
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "vast/Analyses/Iterators.hpp"
#include "vast/Analysis/Iterators.hpp"

Check notice on line 1 in lib/vast/Analysis/Iterators.cpp

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on lib/vast/Analysis/Iterators.cpp

File lib/vast/Analysis/Iterators.cpp does not conform to Custom style guidelines. (lines 7, 11, 12, 13, 35, 36, 37, 39, 40, 41, 42)
#include "vast/Interfaces/AST/DeclInterface.hpp"
#include "vast/Interfaces/CFG/CFGInterface.hpp"

namespace vast::analyses {
namespace vast::analysis {

mlir::Operation *decl_interface_iterator::operator*() const { return Current; }
mlir::Operation *decl_interface_iterator::operator->() const { return Current; }
@@ -27,7 +27,7 @@ namespace vast::analyses {
bool operator!=(decl_interface_iterator x, decl_interface_iterator y) {
return x.Current != y.Current;
}
} // namespace vast::analyses
} // namespace vast::analysis

namespace vast::cfg {

2 changes: 1 addition & 1 deletion lib/vast/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -16,4 +16,4 @@ endif()

add_subdirectory(Tower)
add_subdirectory(Util)
add_subdirectory(Analyses)
add_subdirectory(Analysis)
8 changes: 4 additions & 4 deletions lib/vast/Dialect/HighLevel/HighLevelOps.cpp
Original file line number Diff line number Diff line change
@@ -270,20 +270,20 @@ namespace vast::hl
return false;
}

vast::analyses::decl_interface_iterator FuncOp::decls_begin() {
vast::analysis::decl_interface_iterator FuncOp::decls_begin() {
for (auto &region : this->getOperation()->getRegions()) {
for (auto &block : region.getBlocks()) {
for (auto &operation : block.getOperations()) {
if (isa< ast::DeclInterface >(operation)) {
return analyses::decl_interface_iterator{dyn_cast< ast::DeclInterface >(operation)};
return analysis::decl_interface_iterator{dyn_cast< ast::DeclInterface >(operation)};
}
}
}
}
return analyses::decl_interface_iterator{nullptr};
return analysis::decl_interface_iterator{nullptr};
}

vast::analyses::decl_interface_iterator FuncOp::decls_end() {
vast::analysis::decl_interface_iterator FuncOp::decls_end() {
return {};
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) 2024-present, Trail of Bits, Inc.

#include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.hpp"
#include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.hpp"

//===----------------------------------------------------------------------===//
// ASTNodes Op Interface
//===----------------------------------------------------------------------===//

/// Include the generated interface.
#include "vast/Interfaces/Analyses/AnalysisDeclContextInterface.cpp.inc"
#include "vast/Interfaces/Analysis/AnalysisDeclContextInterface.cpp.inc"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2024-present, Trail of Bits, Inc.

add_vast_interface_library(InterfacesAnalyses
add_vast_interface_library(InterfacesAnalysis
AnalysisDeclContextInterface.cpp
)
2 changes: 1 addition & 1 deletion lib/vast/Interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -31,5 +31,5 @@ add_vast_interface_library(ElementTypeInterface
)

add_subdirectory(AST)
add_subdirectory(Analyses)
add_subdirectory(Analysis)
add_subdirectory(CFG)
Loading

0 comments on commit f7308ba

Please sign in to comment.