clang 24.0.0git
ClangCLArgs.h
Go to the documentation of this file.
1//===--- ClangCLArgs.h - clang-cl arguments ---------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_LIB_DRIVER_CLANGCLARGS_H
10#define LLVM_CLANG_LIB_DRIVER_CLANGCLARGS_H
11
12#include "llvm/Support/Compiler.h"
13
14namespace llvm {
15class Triple;
16namespace opt {
17class Arg;
18class ArgList;
19class DerivedArgList;
20} // namespace opt
21} // namespace llvm
22
23namespace clang::driver {
24
25/// Translate clang-cl options before and after offload argument filtering.
26class LLVM_LIBRARY_VISIBILITY ClangCLArgs {
27 const char *ExpandChar = nullptr;
28 bool SupportsForcingFramePointer;
29
30public:
31 /// The argument values must outlive this translator.
32 ClangCLArgs(const llvm::opt::ArgList &Args, const llvm::Triple &HostTriple);
33
34 /// Append the canonical translation of A to DAL. Return false without
35 /// modifying DAL if A is not handled. If supplied, Owner owns synthesized
36 /// arguments instead of DAL and must outlive its consumers.
37 bool translateArg(llvm::opt::Arg *A, llvm::opt::DerivedArgList &DAL,
38 const llvm::opt::DerivedArgList *Owner = nullptr) const;
39
40 /// Translate a filtered list that may contain new clang-cl options, replacing
41 /// earlier /O expansions. The caller owns the returned list; Owner owns its
42 /// synthesized arguments and must outlive its consumers.
43 static llvm::opt::DerivedArgList *
44 translateArgs(const llvm::opt::DerivedArgList &Args,
45 const llvm::Triple &HostTriple,
46 const llvm::opt::DerivedArgList &Owner);
47
48 /// Normalize MSVC's '#' macro separator, also used by Clang targeting MSVC
49 /// and by arguments parsed after host/device filtering. Any replacement
50 /// string has the lifetime of Args; otherwise return Value unchanged.
51 static const char *translateMacroDefinition(const char *Value,
52 const llvm::opt::ArgList &Args);
53};
54
55} // namespace clang::driver
56
57#endif // LLVM_CLANG_LIB_DRIVER_CLANGCLARGS_H
bool translateArg(llvm::opt::Arg *A, llvm::opt::DerivedArgList &DAL, const llvm::opt::DerivedArgList *Owner=nullptr) const
Append the canonical translation of A to DAL.
static llvm::opt::DerivedArgList * translateArgs(const llvm::opt::DerivedArgList &Args, const llvm::Triple &HostTriple, const llvm::opt::DerivedArgList &Owner)
Translate a filtered list that may contain new clang-cl options, replacing earlier /O expansions.
static const char * translateMacroDefinition(const char *Value, const llvm::opt::ArgList &Args)
Normalize MSVC's '#' macro separator, also used by Clang targeting MSVC and by arguments parsed after...
ClangCLArgs(const llvm::opt::ArgList &Args, const llvm::Triple &HostTriple)
The argument values must outlive this translator.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30