FLANG
PreprocessorOptions.h
Go to the documentation of this file.
1//===- PreprocessorOptions.h ------------------------------------*- 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//===----------------------------------------------------------------------===//
13//===----------------------------------------------------------------------===//
14//
15// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
16//
17//===----------------------------------------------------------------------===//
18
19#ifndef FORTRAN_FRONTEND_PREPROCESSOROPTIONS_H
20#define FORTRAN_FRONTEND_PREPROCESSOROPTIONS_H
21
22#include "llvm/ADT/StringRef.h"
23
24namespace Fortran::frontend {
25
28enum class PPMacrosFlag : uint8_t {
30 Unknown,
31
32 Include,
33 Exclude
34};
35
40
41 std::vector<std::pair<std::string, /*isUndef*/ bool>> macros;
42
43 // Search directories specified by the user with -I
44 // TODO: When adding support for more options related to search paths,
45 // consider collecting them in a separate aggregate. For now we keep it here
46 // as there is no point creating a class for just one field.
47 std::vector<std::string> searchDirectoriesFromDashI;
48 // Search directories specified by the user with -fintrinsic-modules-path
49 std::vector<std::string> searchDirectoriesFromIntrModPath;
50
51 PPMacrosFlag macrosFlag = PPMacrosFlag::Unknown;
52
53 // -P: Suppress #line directives in -E output
54 bool noLineDirectives{false};
55
56 // -fno-reformat: Emit cooked character stream as -E output
57 bool noReformat{false};
58
59 // -fpreprocess-include-lines: Treat INCLUDE as #include for -E output
60 bool preprocessIncludeLines{false};
61
62 // -dM: Show macro definitions with -dM -E
63 bool showMacros{false};
64
65 void addMacroDef(llvm::StringRef name) {
66 macros.emplace_back(std::string(name), false);
67 }
68
69 void addMacroUndef(llvm::StringRef name) {
70 macros.emplace_back(std::string(name), true);
71 }
72};
73
74} // namespace Fortran::frontend
75
76#endif // FORTRAN_FRONTEND_PREPROCESSOROPTIONS_H
PPMacrosFlag
Definition: PreprocessorOptions.h:28
Definition: PreprocessorOptions.h:38