Skip to content

Commit 3a172fb

Browse files
committed
[Macros] Miscellaneous build fixes for macros.
1 parent 010f867 commit 3a172fb

File tree

6 files changed

+11
-0
lines changed

6 files changed

+11
-0
lines changed

lib/Refactoring/Refactoring.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ static void analyzeRenameScope(ValueDecl *VD, Optional<RenameRefInfo> RefInfo,
884884
case DeclContextKind::SerializedLocal:
885885
case DeclContextKind::Module:
886886
case DeclContextKind::FileUnit:
887+
case DeclContextKind::MacroDecl:
887888
break;
888889
}
889890

@@ -1074,6 +1075,7 @@ ExtractCheckResult checkExtractConditions(const ResolvedRangeInfo &RangeInfo,
10741075
case swift::DeclContextKind::FileUnit:
10751076
case swift::DeclContextKind::GenericTypeDecl:
10761077
case swift::DeclContextKind::ExtensionDecl:
1078+
case swift::DeclContextKind::MacroDecl:
10771079
return ExtractCheckResult();
10781080
}
10791081
return ExtractCheckResult(AllReasons);

lib/Sema/TypeCheckMacros.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ getMacroSignatureContextBuffer(
9494
return {buffer, len};
9595
}
9696

97+
#if SWIFT_SWIFT_PARSER
98+
9799
/// Compute the macro signature for a macro given the source code for its
98100
/// generic signature and type signature.
99101
static Optional<std::pair<GenericSignature, Type>>
@@ -290,6 +292,7 @@ static MacroDecl *createPluginMacro(
290292
mod, macroName, MacroDecl::ImplementationKind::Plugin, genSignature,
291293
typeSignature, owningModuleName, supplementalModuleNames, plugin);
292294
}
295+
#endif
293296

294297
ArrayRef<MacroDecl *> MacroLookupRequest::evaluate(
295298
Evaluator &evaluator, Identifier macroName, ModuleDecl *mod

tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ static bool initDocEntityInfo(const Decl *D,
508508
case DeclContextKind::SerializedLocal:
509509
case DeclContextKind::ExtensionDecl:
510510
case DeclContextKind::GenericTypeDecl:
511+
case DeclContextKind::MacroDecl:
511512
break;
512513

513514
// We report sub-module information only for top-level decls.

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,7 @@ static Optional<AccessLevel> inferAccessSyntactically(const ValueDecl *D) {
12171217
return AccessLevel::Private;
12181218
case DeclContextKind::Module:
12191219
case DeclContextKind::FileUnit:
1220+
case DeclContextKind::MacroDecl:
12201221
return AccessLevel::Internal;
12211222
case DeclContextKind::GenericTypeDecl: {
12221223
auto generic = cast<GenericTypeDecl>(DC);

tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ UIdent SwiftLangSupport::getUIDForCodeCompletionDeclKind(
412412
case CodeCompletionDeclKind::InstanceVar: return KindRefVarInstance;
413413
case CodeCompletionDeclKind::LocalVar: return KindRefVarLocal;
414414
case CodeCompletionDeclKind::GlobalVar: return KindRefVarGlobal;
415+
case CodeCompletionDeclKind::Macro: return KindRefMacro;
415416
}
416417
}
417418

@@ -440,6 +441,7 @@ UIdent SwiftLangSupport::getUIDForCodeCompletionDeclKind(
440441
case CodeCompletionDeclKind::InstanceVar: return KindDeclVarInstance;
441442
case CodeCompletionDeclKind::LocalVar: return KindDeclVarLocal;
442443
case CodeCompletionDeclKind::GlobalVar: return KindDeclVarGlobal;
444+
case CodeCompletionDeclKind::Macro: return KindDeclMacro;
443445
}
444446

445447
llvm_unreachable("Unhandled CodeCompletionDeclKind in switch.");

utils/gyb_sourcekit_support/UIDs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ def __init__(self, internal_name, external_name):
371371
KIND('RefTypeAlias', 'source.lang.swift.ref.typealias'),
372372
KIND('DeclGenericTypeParam', 'source.lang.swift.decl.generic_type_param'),
373373
KIND('RefGenericTypeParam', 'source.lang.swift.ref.generic_type_param'),
374+
KIND('DeclMacro', 'source.lang.swift.decl.macro'),
375+
KIND('RefMacro', 'source.lang.swift.ref.macro'),
374376
KIND('RefModule', 'source.lang.swift.ref.module'),
375377
KIND('CommentTag', 'source.lang.swift.commenttag'),
376378
KIND('StmtForEach', 'source.lang.swift.stmt.foreach'),

0 commit comments

Comments
 (0)