Skip to content

Commit b015217

Browse files
committed
[llvm] export private API so that FileCheckTests builds against Windows DLL
1 parent 2d508e0 commit b015217

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

llvm/lib/FileCheck/FileCheckImpl.h

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/ADT/StringMap.h"
2020
#include "llvm/ADT/StringRef.h"
2121
#include "llvm/FileCheck/FileCheck.h"
22+
#include "llvm/Support/Compiler.h"
2223
#include "llvm/Support/Error.h"
2324
#include "llvm/Support/SourceMgr.h"
2425
#include <map>
@@ -88,23 +89,23 @@ struct ExpressionFormat {
8889
/// \returns a wildcard regular expression string that matches any value in
8990
/// the format represented by this instance and no other value, or an error
9091
/// if the format is NoFormat.
91-
Expected<std::string> getWildcardRegex() const;
92+
LLVM_ABI Expected<std::string> getWildcardRegex() const;
9293

9394
/// \returns the string representation of \p Value in the format represented
9495
/// by this instance, or an error if conversion to this format failed or the
9596
/// format is NoFormat.
96-
Expected<std::string> getMatchingString(APInt Value) const;
97+
LLVM_ABI Expected<std::string> getMatchingString(APInt Value) const;
9798

9899
/// \returns the value corresponding to string representation \p StrVal
99100
/// according to the matching format represented by this instance.
100-
APInt valueFromStringRepr(StringRef StrVal, const SourceMgr &SM) const;
101+
LLVM_ABI APInt valueFromStringRepr(StringRef StrVal, const SourceMgr &SM) const;
101102
};
102103

103104
/// Class to represent an overflow error that might result when manipulating a
104105
/// value.
105106
class OverflowError : public ErrorInfo<OverflowError> {
106107
public:
107-
static char ID;
108+
LLVM_ABI static char ID;
108109

109110
std::error_code convertToErrorCode() const override {
110111
return std::make_error_code(std::errc::value_too_large);
@@ -115,10 +116,10 @@ class OverflowError : public ErrorInfo<OverflowError> {
115116

116117
/// Performs operation and \returns its result or an error in case of failure,
117118
/// such as if an overflow occurs.
118-
Expected<APInt> exprAdd(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
119-
Expected<APInt> exprSub(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
120-
Expected<APInt> exprMul(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
121-
Expected<APInt> exprDiv(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
119+
LLVM_ABI Expected<APInt> exprAdd(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
120+
LLVM_ABI Expected<APInt> exprSub(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
121+
LLVM_ABI Expected<APInt> exprMul(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
122+
LLVM_ABI Expected<APInt> exprDiv(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
122123
Expected<APInt> exprMax(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
123124
Expected<APInt> exprMin(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
124125

@@ -169,7 +170,7 @@ class UndefVarError : public ErrorInfo<UndefVarError> {
169170
StringRef VarName;
170171

171172
public:
172-
static char ID;
173+
LLVM_ABI static char ID;
173174

174175
UndefVarError(StringRef VarName) : VarName(VarName) {}
175176

@@ -277,7 +278,7 @@ class NumericVariable {
277278

278279
/// Class representing the use of a numeric variable in the AST of an
279280
/// expression.
280-
class NumericVariableUse : public ExpressionAST {
281+
class LLVM_ABI NumericVariableUse : public ExpressionAST {
281282
private:
282283
/// Pointer to the class instance for the variable this use is about.
283284
NumericVariable *Variable;
@@ -299,7 +300,7 @@ class NumericVariableUse : public ExpressionAST {
299300
using binop_eval_t = Expected<APInt> (*)(const APInt &, const APInt &, bool &);
300301

301302
/// Class representing a single binary operation in the AST of an expression.
302-
class BinaryOperation : public ExpressionAST {
303+
class LLVM_ABI BinaryOperation : public ExpressionAST {
303304
private:
304305
/// Left operand.
305306
std::unique_ptr<ExpressionAST> LeftOperand;
@@ -371,7 +372,7 @@ class Substitution {
371372
virtual Expected<std::string> getResult() const = 0;
372373
};
373374

374-
class StringSubstitution : public Substitution {
375+
class LLVM_ABI StringSubstitution : public Substitution {
375376
public:
376377
StringSubstitution(FileCheckPatternContext *Context, StringRef VarName,
377378
size_t InsertIdx)
@@ -382,7 +383,7 @@ class StringSubstitution : public Substitution {
382383
Expected<std::string> getResult() const override;
383384
};
384385

385-
class NumericSubstitution : public Substitution {
386+
class LLVM_ABI NumericSubstitution : public Substitution {
386387
private:
387388
/// Pointer to the class representing the expression whose value is to be
388389
/// substituted.
@@ -447,24 +448,24 @@ class FileCheckPatternContext {
447448
public:
448449
/// \returns the value of string variable \p VarName or an error if no such
449450
/// variable has been defined.
450-
Expected<StringRef> getPatternVarValue(StringRef VarName);
451+
LLVM_ABI Expected<StringRef> getPatternVarValue(StringRef VarName);
451452

452453
/// Defines string and numeric variables from definitions given on the
453454
/// command line, passed as a vector of [#]VAR=VAL strings in
454455
/// \p CmdlineDefines. \returns an error list containing diagnostics against
455456
/// \p SM for all definition parsing failures, if any, or Success otherwise.
456-
Error defineCmdlineVariables(ArrayRef<StringRef> CmdlineDefines,
457+
LLVM_ABI Error defineCmdlineVariables(ArrayRef<StringRef> CmdlineDefines,
457458
SourceMgr &SM);
458459

459460
/// Create @LINE pseudo variable. Value is set when pattern are being
460461
/// matched.
461-
void createLineVariable();
462+
LLVM_ABI void createLineVariable();
462463

463464
/// Undefines local variables (variables whose name does not start with a '$'
464465
/// sign), i.e. removes them from GlobalVariableTable and from
465466
/// GlobalNumericVariableTable and also clears the value of numeric
466467
/// variables.
467-
void clearLocalVars();
468+
LLVM_ABI void clearLocalVars();
468469

469470
private:
470471
/// Makes a new numeric variable and registers it for destruction when the
@@ -490,7 +491,7 @@ class ErrorDiagnostic : public ErrorInfo<ErrorDiagnostic> {
490491
SMRange Range;
491492

492493
public:
493-
static char ID;
494+
LLVM_ABI static char ID;
494495

495496
ErrorDiagnostic(SMDiagnostic &&Diag, SMRange Range)
496497
: Diagnostic(Diag), Range(Range) {}
@@ -520,7 +521,7 @@ class ErrorDiagnostic : public ErrorInfo<ErrorDiagnostic> {
520521

521522
class NotFoundError : public ErrorInfo<NotFoundError> {
522523
public:
523-
static char ID;
524+
LLVM_ABI static char ID;
524525

525526
std::error_code convertToErrorCode() const override {
526527
return inconvertibleErrorCode();
@@ -644,7 +645,7 @@ class Pattern {
644645
FileCheckPatternContext *getContext() const { return Context; }
645646

646647
/// \returns whether \p C is a valid first character for a variable name.
647-
static bool isValidVarNameStart(char C);
648+
LLVM_ABI static bool isValidVarNameStart(char C);
648649

649650
/// Parsing information about a variable.
650651
struct VariableProperties {
@@ -657,7 +658,7 @@ class Pattern {
657658
/// is the name of a pseudo variable, or an error holding a diagnostic
658659
/// against \p SM if parsing fail. If parsing was successful, also strips
659660
/// \p Str from the variable name.
660-
static Expected<VariableProperties> parseVariable(StringRef &Str,
661+
LLVM_ABI static Expected<VariableProperties> parseVariable(StringRef &Str,
661662
const SourceMgr &SM);
662663
/// Parses \p Expr for a numeric substitution block at line \p LineNumber,
663664
/// or before input is parsed if \p LineNumber is None. Parameter
@@ -669,7 +670,7 @@ class Pattern {
669670
/// successful, sets \p DefinedNumericVariable to point to the class
670671
/// representing the numeric variable defined in this numeric substitution
671672
/// block, or std::nullopt if this block does not define any variable.
672-
static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
673+
LLVM_ABI static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
673674
StringRef Expr, std::optional<NumericVariable *> &DefinedNumericVariable,
674675
bool IsLegacyLineExpr, std::optional<size_t> LineNumber,
675676
FileCheckPatternContext *Context, const SourceMgr &SM);
@@ -680,7 +681,7 @@ class Pattern {
680681
/// global options that influence the parsing such as whitespace
681682
/// canonicalization, \p SM provides the SourceMgr used for error reports.
682683
/// \returns true in case of an error, false otherwise.
683-
bool parsePattern(StringRef PatternStr, StringRef Prefix, SourceMgr &SM,
684+
LLVM_ABI bool parsePattern(StringRef PatternStr, StringRef Prefix, SourceMgr &SM,
684685
const FileCheckRequest &Req);
685686
struct Match {
686687
size_t Pos;
@@ -705,7 +706,7 @@ class Pattern {
705706
/// GlobalNumericVariableTable StringMap in the same class provides the
706707
/// current values of FileCheck numeric variables and is updated if this
707708
/// match defines new numeric values.
708-
MatchResult match(StringRef Buffer, const SourceMgr &SM) const;
709+
LLVM_ABI MatchResult match(StringRef Buffer, const SourceMgr &SM) const;
709710
/// Prints the value of successful substitutions.
710711
void printSubstitutions(const SourceMgr &SM, StringRef Buffer,
711712
SMRange MatchRange, FileCheckDiag::MatchType MatchTy,
@@ -716,7 +717,7 @@ class Pattern {
716717
bool hasVariable() const {
717718
return !(Substitutions.empty() && VariableDefs.empty());
718719
}
719-
void printVariableDefs(const SourceMgr &SM, FileCheckDiag::MatchType MatchTy,
720+
LLVM_ABI void printVariableDefs(const SourceMgr &SM, FileCheckDiag::MatchType MatchTy,
720721
std::vector<FileCheckDiag> *Diags) const;
721722

722723
Check::FileCheckType getCheckTy() const { return CheckTy; }

0 commit comments

Comments
 (0)