23
23
#include " swift/Basic/JSONSerialization.h"
24
24
#include " swift/Basic/SourceManager.h"
25
25
#include " swift/Frontend/FrontendOptions.h"
26
+ #include " swift/Frontend/ModuleInterfaceSupport.h"
26
27
#include " swift/IDE/SourceEntityWalker.h"
27
28
28
29
#include " clang/AST/DeclObjC.h"
@@ -819,6 +820,7 @@ bool swift::emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
819
820
const static unsigned OBJC_METHOD_TRACE_FILE_FORMAT_VERSION = 1 ;
820
821
821
822
class ObjcMethodReferenceCollector : public SourceEntityWalker {
823
+ std::string compilerVer;
822
824
std::string target;
823
825
std::string targetVariant;
824
826
SmallVector<StringRef, 32 > FilePaths;
@@ -855,6 +857,8 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
855
857
}
856
858
public:
857
859
ObjcMethodReferenceCollector (ModuleDecl *MD) {
860
+ compilerVer =
861
+ getSwiftInterfaceCompilerVersionForCurrentCompiler (MD->getASTContext ());
858
862
auto &Opts = MD->getASTContext ().LangOpts ;
859
863
target = Opts.Target .str ();
860
864
targetVariant = Opts.TargetVariant .has_value () ?
@@ -868,6 +872,7 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
868
872
void serializeAsJson (llvm::raw_ostream &OS) {
869
873
llvm::json::OStream out (OS, /* IndentSize=*/ 4 );
870
874
out.object ([&] {
875
+ out.attribute (" swift-compiler-version" , compilerVer);
871
876
out.attribute (" format-vesion" , OBJC_METHOD_TRACE_FILE_FORMAT_VERSION);
872
877
out.attribute (" target" , target);
873
878
if (!targetVariant.empty ())
0 commit comments