Files
swift-mirror/include/swift/Parse/ParseSILSupport.h
Andrew Trick 7c4d15f96a SILModule::isVisibleExternally utility for VarDecls. (#16834)
* SILModule::isVisibleExternally utility for VarDecls.

* Fix the SIL parser so it doesn't drop global variable decls.

This information was getting lost in SIL printing/parsing.
Some passes rely on it. Regardless of whether passes should rely on it,
it is totally unacceptable for the SIL passes to have subtle differences
in behavior depending on the frontend mode. So, if we don't want passes
to rely on global variable decls, that needs to be enforced by the API
independent of how the frontend is invoked or how SIL is serialized.

* Use custom DemangleOptions to lookup global variable identifiers.
2018-06-26 12:27:26 -07:00

52 lines
1.7 KiB
C++

//===--- ParseSILSupport.h - Interface with ParseSIL ------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_PARSER_PARSESILSUPPORT_H
#define SWIFT_PARSER_PARSESILSUPPORT_H
#include "llvm/Support/PrettyStackTrace.h"
namespace swift {
class Parser;
/// Interface between the Parse and ParseSIL libraries, to avoid circular
/// dependencies.
class SILParserTUStateBase {
virtual void anchor();
protected:
SILParserTUStateBase() = default;
virtual ~SILParserTUStateBase() = default;
public:
virtual bool parseDeclSIL(Parser &P) = 0;
virtual bool parseDeclSILStage(Parser &P) = 0;
virtual bool parseSILVTable(Parser &P) = 0;
virtual bool parseSILGlobal(Parser &P) = 0;
virtual bool parseSILWitnessTable(Parser &P) = 0;
virtual bool parseSILDefaultWitnessTable(Parser &P) = 0;
virtual bool parseSILCoverageMap(Parser &P) = 0;
virtual bool parseSILProperty(Parser &P) = 0;
virtual bool parseSILScope(Parser &P) = 0;
};
/// To assist debugging parser crashes, tell us the location of the
/// current token.
class PrettyStackTraceParser : public llvm::PrettyStackTraceEntry {
Parser &P;
public:
explicit PrettyStackTraceParser(Parser &P) : P(P) {}
void print(llvm::raw_ostream &out) const override;
};
} // end namespace swift
#endif // SWIFT_PARSER_PARSESILSUPPORT_H