[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 11 12:51:50 PST 2018


Szelethus added inline comments.


================
Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:56-59
+    StringRef SourceText =
+        Lexer::getSourceText(CharSourceRange::getTokenRange(ConditionRange),
+                             PP.getSourceManager(), PP.getLangOpts());
+    std::string Condition = getCondition(SourceText);
----------------
I'm a little confused. To me, it seems like you acquired the condition already -- doesn't `ConditionRange` actually cover the, well, condition range? This is how I imagined it:

```
#ifdef CUTE_PANDA_CUBS
       ^~~~~~~~~~~~~~~
       ConditionRange
```
Why is there a need for `getCondition`? Is there any? If there is (maybe the acquired text contains other things), can you document it? I haven't played with `PPCallbacks` much, so I'm fine with being in the wrong.


https://reviews.llvm.org/D54349





More information about the cfe-commits mailing list