mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Frontend] Allow additional files for diagnostic verifier
This change adds a frontend flag, -verify-additional-file, which can be used to pass extra files directly to the diagnostic verifier. These files are not otherwise considered to be Swift source files; they are not compiled or even properly parsed. This feature can be used to verify diagnostics emitted in non-source files, such as in module interfaces or header files.
This commit is contained in:
committed by
Alexis Laferrière
parent
ba00258c66
commit
5036a55550
@@ -65,6 +65,7 @@ class DiagnosticVerifier : public DiagnosticConsumer {
|
||||
SourceManager &SM;
|
||||
std::vector<CapturedDiagnosticInfo> CapturedDiagnostics;
|
||||
ArrayRef<unsigned> BufferIDs;
|
||||
SmallVector<unsigned, 4> AdditionalBufferIDs;
|
||||
bool AutoApplyFixes;
|
||||
bool IgnoreUnknown;
|
||||
|
||||
@@ -74,6 +75,10 @@ public:
|
||||
: SM(SM), BufferIDs(BufferIDs), AutoApplyFixes(AutoApplyFixes),
|
||||
IgnoreUnknown(IgnoreUnknown) {}
|
||||
|
||||
void appendAdditionalBufferID(unsigned bufferID) {
|
||||
AdditionalBufferIDs.push_back(bufferID);
|
||||
}
|
||||
|
||||
virtual void handleDiagnostic(SourceManager &SM,
|
||||
const DiagnosticInfo &Info) override;
|
||||
|
||||
|
||||
@@ -560,8 +560,11 @@ private:
|
||||
bool setUpInputs();
|
||||
bool setUpASTContextIfNeeded();
|
||||
void setupStatsReporter();
|
||||
void setupDiagnosticVerifierIfNeeded();
|
||||
void setupDependencyTrackerIfNeeded();
|
||||
|
||||
/// \return false if successsful, true on error.
|
||||
bool setupDiagnosticVerifierIfNeeded();
|
||||
|
||||
Optional<unsigned> setUpCodeCompletionBuffer();
|
||||
|
||||
/// Find a buffer for a given input file and ensure it is recorded in
|
||||
|
||||
Reference in New Issue
Block a user