177{
178 const auto* alias = result.Nodes.getNodeAs<clang::TypeAliasDecl>(request_id);
179 if (alias == nullptr) {
180 return;
181 }
182
184
185 const clang::SourceManager& manager = *result.SourceManager;
186 const clang::SourceLocation location = manager.getExpansionLoc(alias->getBeginLoc());
187 if (!location.isValid() || manager.isInSystemHeader(location)) {
189 return;
190 }
191
192 const std::filesystem::path header = real_path(manager.getFilename(location));
193 const unsigned line = manager.getSpellingLineNumber(location);
194 const std::string where = header.string() + ":" + std::to_string(line) + ": ";
195 const std::string spelling = alias->getUnderlyingType().getAsString();
196
197 if (!alias->getDeclContext()->getRedeclContext()->isFileContext()) {
198 m_errors.push_back(where +
"MF_DESCRIBE must appear at namespace scope");
199 return;
200 }
201
202 const clang::CXXRecordDecl*
record = alias->getUnderlyingType()->getAsCXXRecordDecl();
205 }
207 m_errors.push_back(where + spelling +
": request must name a complete struct or class");
208 return;
209 }
210 if (llvm::isa<clang::ClassTemplateSpecializationDecl>(
record) ||
record->isUnion() || !nameable(
record)) {
211 m_errors.push_back(where + spelling +
": template, union, anonymous and inaccessible records are unsupported");
212 return;
213 }
214
215 unsigned anchor =
line;
216 const clang::NamespaceDecl* outermost = nullptr;
217 for (const clang::DeclContext* context = alias->getLexicalDeclContext();
218 context != nullptr && !context->isTranslationUnit(); context = context->getLexicalParent()) {
219 if (const auto* space = llvm::dyn_cast<clang::NamespaceDecl>(context)) {
220 outermost = space;
221 }
222 }
223 if (outermost != nullptr && outermost->getRBraceLoc().isValid()) {
224 anchor = manager.getSpellingLineNumber(manager.getExpansionLoc(outermost->getRBraceLoc()));
225 }
226
227 RecordRequest request;
228 request.name =
record->getQualifiedNameAsString();
229 request.line = anchor;
230
231 std::vector<const clang::CXXRecordDecl*> nested;
233 if (!collect_members(
record, request.members, nested, error)) {
234 m_errors.push_back(where + request.name +
": " + error);
235 return;
236 }
237 if (!
store(header, std::move(request), where)) {
238 return;
239 }
240 for (const clang::CXXRecordDecl* child : nested) {
241 if (file_of(manager, child->getLocation()) == header) {
243 }
244 }
245}
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.
Vruta::SoundRoutine line(float start_value, float end_value, float duration_seconds, uint32_t step_duration, bool restartable)
Creates a continuous interpolation generator between two values over time.
std::pair< std::shared_ptr< Kriya::BufferPipeline >, std::shared_ptr< Buffers::AudioBuffer > > record(const std::shared_ptr< Kakshya::DynamicSoundStream > &stream, uint32_t input_channel, double seconds, std::optional< uint32_t > monitor, uint32_t channel)
Record a live input channel into a stream for a number of seconds.