forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I1f2ba7628f710a9d5a381d4a7d6cef7b53f266a8
- Loading branch information
Showing
220 changed files
with
5,100 additions
and
2,844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===- InstallAPI/FileList.h ------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// The JSON file list parser is used to communicate input to InstallAPI. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_INSTALLAPI_FILELIST_H | ||
#define LLVM_CLANG_INSTALLAPI_FILELIST_H | ||
|
||
#include "clang/Basic/Diagnostic.h" | ||
#include "clang/Basic/FileManager.h" | ||
#include "clang/InstallAPI/HeaderFile.h" | ||
#include "llvm/Support/Error.h" | ||
#include "llvm/Support/MemoryBuffer.h" | ||
|
||
namespace clang { | ||
namespace installapi { | ||
|
||
class FileListReader { | ||
public: | ||
/// Decode JSON input and append header input into destination container. | ||
/// Headers are loaded in the order they appear in the JSON input. | ||
/// | ||
/// \param InputBuffer JSON input data. | ||
/// \param Destination Container to load headers into. | ||
static llvm::Error | ||
loadHeaders(std::unique_ptr<llvm::MemoryBuffer> InputBuffer, | ||
HeaderSeq &Destination); | ||
|
||
FileListReader() = delete; | ||
}; | ||
|
||
} // namespace installapi | ||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_INSTALLAPI_FILELIST_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//===- InstallAPI/HeaderFile.h ----------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// Representations of a library's headers for InstallAPI. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_INSTALLAPI_HEADERFILE_H | ||
#define LLVM_CLANG_INSTALLAPI_HEADERFILE_H | ||
|
||
#include "clang/Basic/LangStandard.h" | ||
#include "llvm/ADT/StringRef.h" | ||
#include "llvm/Support/Regex.h" | ||
#include <optional> | ||
#include <string> | ||
|
||
namespace clang::installapi { | ||
enum class HeaderType { | ||
/// Represents declarations accessible to all clients. | ||
Public, | ||
/// Represents declarations accessible to a disclosed set of clients. | ||
Private, | ||
/// Represents declarations only accessible as implementation details to the | ||
/// input library. | ||
Project, | ||
}; | ||
|
||
class HeaderFile { | ||
/// Full input path to header. | ||
std::string FullPath; | ||
/// Access level of header. | ||
HeaderType Type; | ||
/// Expected way header will be included by clients. | ||
std::string IncludeName; | ||
/// Supported language mode for header. | ||
std::optional<clang::Language> Language; | ||
|
||
public: | ||
HeaderFile(StringRef FullPath, HeaderType Type, | ||
StringRef IncludeName = StringRef(), | ||
std::optional<clang::Language> Language = std::nullopt) | ||
: FullPath(FullPath), Type(Type), IncludeName(IncludeName), | ||
Language(Language) {} | ||
|
||
static llvm::Regex getFrameworkIncludeRule(); | ||
|
||
bool operator==(const HeaderFile &Other) const { | ||
return std::tie(Type, FullPath, IncludeName, Language) == | ||
std::tie(Other.Type, Other.FullPath, Other.IncludeName, | ||
Other.Language); | ||
} | ||
}; | ||
|
||
/// Assemble expected way header will be included by clients. | ||
/// As in what maps inside the brackets of `#include <IncludeName.h>` | ||
/// For example, | ||
/// "/System/Library/Frameworks/Foo.framework/Headers/Foo.h" returns | ||
/// "Foo/Foo.h" | ||
/// | ||
/// \param FullPath Path to the header file which includes the library | ||
/// structure. | ||
std::optional<std::string> createIncludeHeaderName(const StringRef FullPath); | ||
using HeaderSeq = std::vector<HeaderFile>; | ||
|
||
} // namespace clang::installapi | ||
|
||
#endif // LLVM_CLANG_INSTALLAPI_HEADERFILE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ add_clang_library(clangExtractAPI | |
clangBasic | ||
clangFrontend | ||
clangIndex | ||
clangInstallAPI | ||
clangLex | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.