Skip to content

Commit 26a3c45

Browse files
authored
Merge pull request #61729 from augusto2112/expose-isKnownCFTypeName
Expose "isKnownCFTypeName" through ClangImporter
2 parents 5456c71 + 7a7663e commit 26a3c45

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

include/swift/ClangImporter/ClangImporter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ class ClangImporter final : public ClangModuleLoader {
194194
IntermoduleDepTrackingMode Mode,
195195
std::shared_ptr<llvm::FileCollectorBase> FileCollector);
196196

197+
static bool isKnownCFTypeName(llvm::StringRef name);
198+
197199
/// Append visible module names to \p names. Note that names are possibly
198200
/// duplicated, and not guaranteed to be ordered in any way.
199201
void collectVisibleTopLevelModuleNames(

lib/ClangImporter/CFTypeInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static constexpr const llvm::StringLiteral KnownCFTypes[] = {
4343
const size_t NumKnownCFTypes = sizeof(KnownCFTypes) / sizeof(*KnownCFTypes);
4444

4545
/// Maintain a set of known CF types.
46-
static bool isKnownCFTypeName(StringRef name) {
46+
bool CFPointeeInfo::isKnownCFTypeName(StringRef name) {
4747
return std::binary_search(KnownCFTypes, KnownCFTypes + NumKnownCFTypes,
4848
name, SortByLengthComparator());
4949
}

lib/ClangImporter/CFTypeInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class CFPointeeInfo {
7777
public:
7878
static CFPointeeInfo classifyTypedef(const clang::TypedefNameDecl *decl);
7979

80+
static bool isKnownCFTypeName(llvm::StringRef name);
81+
8082
bool isValid() const { return IsValid; }
8183
explicit operator bool() const { return isValid(); }
8284

lib/ClangImporter/ClangImporter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616
#include "swift/ClangImporter/ClangImporter.h"
17+
#include "CFTypeInfo.h"
1718
#include "ClangDerivedConformances.h"
1819
#include "ClangDiagnosticConsumer.h"
1920
#include "ClangIncludePaths.h"
@@ -403,6 +404,10 @@ ClangImporter::createDependencyCollector(
403404
FileCollector);
404405
}
405406

407+
bool ClangImporter::isKnownCFTypeName(llvm::StringRef name) {
408+
return CFPointeeInfo::isKnownCFTypeName(name);
409+
}
410+
406411
void ClangImporter::Implementation::addBridgeHeaderTopLevelDecls(
407412
clang::Decl *D) {
408413
if (shouldIgnoreBridgeHeaderTopLevelDecl(D))

0 commit comments

Comments
 (0)