[PATCH] D54450: Get the correct range of tokens for preprocessor conditions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 12 14:32:01 PST 2018


aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, dblaikie, echristo.
Herald added subscribers: jsji, kbarton, nemanjai.

While working on https://reviews.llvm.org/D54349, it was noted that the `SourceRange` returned from the preprocessor callbacks was bogus. It was expected to pass the source range for the condition to a `#if` or `#elif` directive, but what was actually passed was a much larger range that could even include all of the conditionally skipped tokens.

This patch adjusts the source range passed in to the callbacks to only include the condition range itself by tracking that information a bit better in the preprocessor.


https://reviews.llvm.org/D54450

Files:
  include/clang/Lex/Preprocessor.h
  lib/Lex/PPDirectives.cpp
  lib/Lex/PPExpressions.cpp
  unittests/Lex/PPCallbacksTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54450.173763.patch
Type: text/x-patch
Size: 13110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181112/e9d27875/attachment-0001.bin>


More information about the cfe-commits mailing list