Skip to content

Commit 0b644cb

Browse files
royjacobsontru
authored andcommitted
[Frontend] Restore Preprocessor::getPredefines()
https://reviews.llvm.org/rG6bbf51f3ed59ae37f0fec729f25af002111c9e74 from May removed Preprocessor::getPredefines() from Clang's API, presumably as a cleanup because this method is unused in the LLVM codebase. However, it was/is used by a small number of third-party tools and is pretty harmless, so this patch adds it back and documents why it's here. The issue was raised in #57483, it would be nice to be able to land it into Clang 15 as it breaks those third-party tools and we can't easily add it back in bug fix releases. Reviewed By: brad.king, thieta Differential Revision: https://reviews.llvm.org/D133044 (cherry picked from commit bb9dedc)
1 parent 98b6628 commit 0b644cb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/include/clang/Lex/Preprocessor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,11 @@ class Preprocessor {
13531353
StringRef getLastMacroWithSpelling(SourceLocation Loc,
13541354
ArrayRef<TokenValue> Tokens) const;
13551355

1356+
/// Get the predefines for this processor.
1357+
/// Used by some third-party tools to inspect and add predefines (see
1358+
/// https://github.com/llvm/llvm-project/issues/57483).
1359+
const std::string &getPredefines() const { return Predefines; }
1360+
13561361
/// Set the predefines for this Preprocessor.
13571362
///
13581363
/// These predefines are automatically injected when parsing the main file.

0 commit comments

Comments
 (0)