Files
swift-mirror/include/swift/SymbolGraphGen/DocumentationCategory.h
Evan Wilde 250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00

51 lines
1.3 KiB
C++

//===--- DocumentationCategory.h - Accessors for @_documentation ----------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SYMBOLGRAPHGEN_DOCUMENTATIONCATEGORY_H
#define SWIFT_SYMBOLGRAPHGEN_DOCUMENTATIONCATEGORY_H
#include "swift/AST/Decl.h"
#include "llvm/Support/Compiler.h"
namespace swift {
namespace symbolgraphgen {
LLVM_ATTRIBUTE_USED
static StringRef documentationMetadataForDecl(const Decl *D) {
if (!D) return {};
if (const auto *DC = D->getAttrs().getAttribute<DocumentationAttr>()) {
return DC->Metadata;
}
return {};
}
LLVM_ATTRIBUTE_USED
static llvm::Optional<AccessLevel>
documentationVisibilityForDecl(const Decl *D) {
if (!D)
return llvm::None;
if (const auto *DC = D->getAttrs().getAttribute<DocumentationAttr>()) {
return DC->Visibility;
}
return llvm::None;
}
} // namespace symbolgraphgen
} // namespace swift
#endif // SWIFT_SYMBOLGRAPHGEN_DOCUMENTATIONCATEGORY_H