1 //===- ASTSourceDescriptor.cpp -------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 /// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules 10 /// and precompiled header files 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "clang/Basic/ASTSourceDescriptor.h" 15 16 namespace clang { 17 ASTSourceDescriptor(Module & M)18ASTSourceDescriptor::ASTSourceDescriptor(Module &M) 19 : Signature(M.Signature), ClangModule(&M) { 20 if (M.Directory) 21 Path = M.Directory->getName(); 22 if (auto File = M.getASTFile()) 23 ASTFile = File->getName(); 24 } 25 getModuleName() const26std::string ASTSourceDescriptor::getModuleName() const { 27 if (ClangModule) 28 return ClangModule->Name; 29 else 30 return std::string(PCHModuleName); 31 } 32 33 } // namespace clang 34