Esempio n. 1
0
void updateArgIfSet(llvm::cl::opt<T> &argValue, const llvm::Optional<T> &configValue)
{
    if (configValue.hasValue() && argValue.getNumOccurrences() == 0)
    {
        argValue.setValue(configValue.getValue());
    }
}
Esempio n. 2
0
int main()
{
    //Timer t;
    Environment env( GetEnvironmentStringsA(), false );

    std::string compilerExecutable;
    PathList pathList;
    getPath( env, pathList );
    if ( !findOnPath( pathList, "cl.exe", compilerExecutable ) )
    {
        std::cerr << "Failed to locate executable 'cl.exe' on PATH.\n";
        return -1;
    }

    bool const disableFallback = !!env.get( "BP_DISABLE_FALLBACK" );
    llvm::Optional<std::string> const portNameVar( env.get( "BP_MANAGER_PORT" ) );

    return distributedCompile(
        "msvc",
        compilerExecutable.c_str(),
        env,
        GetCommandLineA(),
        NULL,
        portNameVar ? portNameVar->data() : "default",
        disableFallback ? NULL : runLocallyFallback,
        const_cast<char *>( compilerExecutable.c_str() )
    );
}
Esempio n. 3
0
FunctionParameterSyntax SyntaxFactory::
makeFunctionParameter(RC<TokenSyntax> ExternalName,
                      RC<TokenSyntax> LocalName,
                      RC<TokenSyntax> Colon,
                      llvm::Optional<TypeSyntax> ParameterTypeSyntax,
                      RC<TokenSyntax> Ellipsis,
                      RC<TokenSyntax> Equal,
                      llvm::Optional<ExprSyntax> DefaultValue,
                      RC<TokenSyntax> TrailingComma) {
  auto Raw = RawSyntax::make(SyntaxKind::FunctionParameter,
                             {
                               ExternalName,
                               LocalName,
                               Colon,
                               ParameterTypeSyntax.hasValue()
                                 ? ParameterTypeSyntax.getValue().getRaw()
                                 : RawSyntax::missing(SyntaxKind::MissingType),
                               Ellipsis,
                               Equal,
                               DefaultValue.hasValue()
                                 ? DefaultValue.getValue().getRaw()
                                 : RawSyntax::missing(SyntaxKind::MissingExpr),
                               TrailingComma,
                             },
                             SourcePresence::Present);
  auto Data = FunctionParameterSyntaxData::make(Raw);
  return { Data, Data.get() };
}
Esempio n. 4
0
SymbolicReferenceExprSyntax
SyntaxFactory::makeSymbolicReferenceExpr(RC<TokenSyntax> Identifier,
  llvm::Optional<GenericArgumentClauseSyntax> GenericArgs) {
  auto Raw = RawSyntax::make(SyntaxKind::SymbolicReferenceExpr,
    {
      Identifier,
      GenericArgs.hasValue()
        ? GenericArgs.getValue().getRaw()
        : RawSyntax::missing(SyntaxKind::GenericArgumentClause)
    },
    SourcePresence::Present);
  auto Data = SymbolicReferenceExprSyntaxData::make(Raw);
  return { Data, Data.get() };
}
Esempio n. 5
0
std::vector<int32_t>
UnixSignals::GetFilteredSignals(llvm::Optional<bool> should_suppress,
                                llvm::Optional<bool> should_stop,
                                llvm::Optional<bool> should_notify) {
  std::vector<int32_t> result;
  for (int32_t signo = GetFirstSignalNumber();
       signo != LLDB_INVALID_SIGNAL_NUMBER;
       signo = GetNextSignalNumber(signo)) {

    bool signal_suppress = false;
    bool signal_stop = false;
    bool signal_notify = false;
    GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify);

    // If any of filtering conditions are not met, we move on to the next
    // signal.
    if (should_suppress.hasValue() &&
        signal_suppress != should_suppress.getValue())
      continue;

    if (should_stop.hasValue() && signal_stop != should_stop.getValue())
      continue;

    if (should_notify.hasValue() && signal_notify != should_notify.getValue())
      continue;

    result.push_back(signo);
  }

  return result;
}
Esempio n. 6
0
FunctionDeclSyntax SyntaxFactory::
makeFunctionDecl(TypeAttributesSyntax Attributes,
                 DeclModifierListSyntax Modifiers,
                 RC<TokenSyntax> FuncKeyword,
                 RC<TokenSyntax> Identifier,
                 llvm::Optional<GenericParameterClauseSyntax> GenericParams,
                 FunctionSignatureSyntax Signature,
                 llvm::Optional<GenericWhereClauseSyntax> GenericWhereClause,
                 llvm::Optional<CodeBlockStmtSyntax> Body) {
  auto Raw = RawSyntax::make(SyntaxKind::FunctionDecl,
    {
      Attributes.getRaw(),
      Modifiers.getRaw(),
      FuncKeyword,
      Identifier,
      GenericParams.hasValue()
       ? GenericParams.getValue().getRaw()
       : SyntaxFactory::makeBlankGenericParameterClause().getRaw(),
      Signature.getRaw(),
      GenericWhereClause.hasValue()
        ? GenericWhereClause.getValue().getRaw()
        : SyntaxFactory::makeBlankGenericWhereClause().getRaw(),
      Body.hasValue()
       ? Body.getValue().getRaw()
       : SyntaxFactory::makeBlankCodeBlock().getRaw()
    },
    SourcePresence::Present);
  auto Data = FunctionDeclSyntaxData::make(Raw);
  return { Data, Data.get() };
}
Esempio n. 7
0
 TestAnalyses &setupAnalyses() {
   assert(F);
   Analyses.emplace(*this);
   return Analyses.getValue();
 }