当前位置: 首页>>代码示例>>C++>>正文


C++ Automaton::getAssertion方法代码示例

本文整理汇总了C++中Automaton::getAssertion方法的典型用法代码示例。如果您正苦于以下问题:C++ Automaton::getAssertion方法的具体用法?C++ Automaton::getAssertion怎么用?C++ Automaton::getAssertion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Automaton的用法示例。


在下文中一共展示了Automaton::getAssertion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Name

vector<Value*> AssertionSiteInstrumenter::CollectArgs(
    Instruction *Before, const Automaton& A,
    Module& Mod, IRBuilder<>& Builder) {

  // Find named values to be passed to instrumentation.
  std::map<string,Value*> ValuesInScope;
  for (auto G = Mod.global_begin(); G != Mod.global_end(); G++)
    ValuesInScope[G->getName()] = G;

  auto *Fn = Before->getParent()->getParent();
  for (auto& Arg : Fn->getArgumentList())
    ValuesInScope[Arg.getName()] = &Arg;

  auto& EntryBlock(*Fn->begin());
  for (auto& I : EntryBlock) {
    auto *Inst = dyn_cast<AllocaInst>(&I);
    if (!Inst)
      break;

    ValuesInScope[Inst->getName()] = Builder.CreateLoad(Inst);
  }

  int ArgSize = 0;
  for (auto& Arg : A.getAssertion().argument())
    if (!Arg.free())
      ArgSize = std::max(ArgSize + 1, Arg.index());

  vector<Value*> Args(ArgSize, NULL);

  for (auto& Arg : A.getAssertion().argument()) {
    if (Arg.free())
      continue;

    string Name(BaseName(Arg));

    if (ValuesInScope.find(Name) == ValuesInScope.end()) {
      string s;
      raw_string_ostream Out(s);

      for (auto v : ValuesInScope) {
        Out << "  \"" << v.first << "\": ";
        v.second->getType()->print(Out);
        Out << "\n";
      }

      panic("assertion references non-existent variable '" + BaseName(Arg)
         + "'; was it defined under '#ifdef TESLA'?\n\n"
           "Variables in scope are:\n" + Out.str());
    }

    Args[Arg.index()] =
      GetArgumentValue(ValuesInScope[Name], Arg, Builder, true);
  }

  return Args;
}
开发者ID:cadets,项目名称:tesla-static-analysis,代码行数:56,代码来源:Assertion.cpp

示例2: CallUpdateState

void EventTranslator::CallUpdateState(const Automaton& A, uint32_t Symbol) {
  std::vector<Value*> Args;
  Args.push_back(InstrCtx.TeslaContext(A.getAssertion().context()));
  Args.push_back(InstrCtx.ExternalDescription(A));
  Args.push_back(ConstantInt::get(InstrCtx.Int32Ty, Symbol));
  Args.push_back(Key);

  Builder.CreateCall(InstrCtx.UpdateStateFn(), Args);
}
开发者ID:CTSRD-TESLA,项目名称:TESLA,代码行数:9,代码来源:EventTranslator.cpp


注:本文中的Automaton::getAssertion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。