diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Basic/ASTSourceDescriptor.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Basic/ASTSourceDescriptor.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/lib/Basic/ASTSourceDescriptor.cpp b/contrib/llvm-project/clang/lib/Basic/ASTSourceDescriptor.cpp new file mode 100644 index 000000000000..8072c08a51d3 --- /dev/null +++ b/contrib/llvm-project/clang/lib/Basic/ASTSourceDescriptor.cpp @@ -0,0 +1,33 @@ +//===- ASTSourceDescriptor.cpp -------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===----------------------------------------------------------------------===// + +#include "clang/Basic/ASTSourceDescriptor.h" + +namespace clang { + +ASTSourceDescriptor::ASTSourceDescriptor(Module &M) + : Signature(M.Signature), ClangModule(&M) { + if (M.Directory) + Path = M.Directory->getName(); + if (auto File = M.getASTFile()) + ASTFile = File->getName(); +} + +std::string ASTSourceDescriptor::getModuleName() const { + if (ClangModule) + return ClangModule->Name; + else + return std::string(PCHModuleName); +} + +} // namespace clang |