mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Ensure that buffers containing Clang swift_attr attributes are parsed as attributes
Previously, they were being parsed as top-level code, which would cause errors because there are no definitions. Introduce a new GeneratedSourceInfo kind to mark the purpose of these buffers so the parser can handle them appropriately.
This commit is contained in:
@@ -862,6 +862,7 @@ ModuleDecl::getOriginalLocation(SourceLoc loc) const {
|
||||
// replaced function bodies. The body is actually different code to the
|
||||
// original file.
|
||||
case GeneratedSourceInfo::PrettyPrinted:
|
||||
case GeneratedSourceInfo::Attribute:
|
||||
// No original location, return the original buffer/location
|
||||
return {startBufferID, startLoc};
|
||||
}
|
||||
@@ -1148,6 +1149,7 @@ std::optional<MacroRole> SourceFile::getFulfilledMacroRole() const {
|
||||
case GeneratedSourceInfo::ReplacedFunctionBody:
|
||||
case GeneratedSourceInfo::PrettyPrinted:
|
||||
case GeneratedSourceInfo::DefaultArgument:
|
||||
case GeneratedSourceInfo::Attribute:
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user