clang: include/clang/Analysis/MacroExpansionContext.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_ANALYSIS_MACROEXPANSIONCONTEXT_H

10#define LLVM_CLANG_ANALYSIS_MACROEXPANSIONCONTEXT_H

11

15#include "llvm/ADT/DenseMap.h"

16#include "llvm/ADT/SmallString.h"

17#include "llvm/ADT/SmallVector.h"

18#include

19

21

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

74public:

75

76

77

79

80

81

82

84

85

86

87

88

89 std::optional

91

92

93

94

95

96 std::optional

98

99

100

101

102

103 std::optional

105

110

111private:

114 using ExpansionMap = llvm::DenseMap<SourceLocation, MacroExpansionText>;

115 using ExpansionRangeMap = llvm::DenseMap<SourceLocation, SourceLocation>;

116 using FormattedExpansionMap = llvm::DenseMap<SourceLocation, std::string>;

117

118

119

120 ExpansionMap ExpandedTokens;

121

122

123

124 ExpansionRangeMap ExpansionRanges;

125

126

127 mutable FormattedExpansionMap FormattedExpandedTokens;

128

132

133

134

135

136 void onTokenLexed(const Token &Tok);

137};

138}

139

140#endif

Defines the clang::LangOptions interface.

Defines the clang::Preprocessor interface.

Defines the clang::SourceLocation class and associated facilities.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

void registerForPreprocessor(Preprocessor &PP)

Register the necessary callbacks to the Preprocessor to record the expansion events and the generated...

LLVM_DUMP_METHOD void dumpExpandedTextsToStream(raw_ostream &OS) const

LLVM_DUMP_METHOD void dumpExpandedTexts() const

LLVM_DUMP_METHOD void dumpExpansionRanges() const

MacroExpansionContext(const LangOptions &LangOpts)

Creates a MacroExpansionContext.

std::optional< StringRef > getFormattedExpandedText(SourceLocation MacroExpansionLoc) const

LLVM_DUMP_METHOD void dumpExpansionRangesToStream(raw_ostream &OS) const

std::optional< StringRef > getExpandedText(SourceLocation MacroExpansionLoc) const

std::optional< StringRef > getOriginalText(SourceLocation MacroExpansionLoc) const

Engages in a tight little dance with the lexer to efficiently preprocess tokens.

Encodes a location in the source.

This class handles loading and caching of source files into memory.

Token - This structure provides full information about a lexed token.

The JSON file list parser is used to communicate input to InstallAPI.