1 //===--- Modularize.h - Common definitions for Modularize -*- C++ -*-----===//
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 /// \file
10 /// Common definitions for Modularize.
11 ///
12 //===--------------------------------------------------------------------===//
13 
14 #ifndef MODULARIZE_H
15 #define MODULARIZE_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/StringRef.h"
22 #include <string>
23 #include <vector>
24 
25 // Save the program name for error messages.
26 extern const char *Argv0;
27 // Save the command line for comments.
28 extern std::string CommandLine;
29 
30 // Dependency types.
31 typedef llvm::SmallVector<std::string, 4> DependentsVector;
32 typedef llvm::StringMap<DependentsVector> DependencyMap;
33 
34 // Global function declarations.
35 
36 /// Create the module map file.
37 /// \param ModuleMapPath The path to the module map file to be generated.
38 /// \param HeaderFileNames The list of header files, absolute native paths.
39 /// \param ProblemFileNames The list of problem header files.
40 /// \param Dependencies Map of headers that depend on other headers.
41 /// \param HeaderPrefix Tells the code where the headers are, if they
42 ///   aren's in the current directory, allowing the generator to strip
43 ///   the leading, non-relative beginning of the header paths.
44 /// RootModuleName If not empty, specifies that a root module
45 ///   should be created with this name.
46 /// \returns True if successful.
47 bool createModuleMap(llvm::StringRef ModuleMapPath,
48                      llvm::ArrayRef<std::string> HeaderFileNames,
49                      llvm::ArrayRef<std::string> ProblemFileNames,
50                      DependencyMap &Dependencies, llvm::StringRef HeaderPrefix,
51                      llvm::StringRef RootModuleName);
52 
53 #endif // MODULARIZE_H
54