[all-commits] [llvm/llvm-project] 411a25: [clang] Make sure argument expansion locations are...

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Wed Apr 22 12:02:14 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 411a254af3ff5dd05e6c522cc7bccdf043967070
      https://github.com/llvm/llvm-project/commit/411a254af3ff5dd05e6c522cc7bccdf043967070
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2020-04-22 (Wed, 22 Apr 2020)

  Changed paths:
    M clang/lib/Basic/SourceManager.cpp
    M clang/lib/Lex/PPLexerChange.cpp
    M clang/unittests/Basic/SourceManagerTest.cpp
    M clang/unittests/Lex/LexerTest.cpp

  Log Message:
  -----------
  [clang] Make sure argument expansion locations are correct in presence of predefined buffer

Summary:
Macro argument expansion logic relies on skipping file IDs that created
as a result of an include. Unfortunately it fails to do that for
predefined buffer since it doesn't have a valid insertion location.

As a result of that any file ID created for an include inside the
predefined buffers breaks the traversal logic in
SourceManager::computeMacroArgsCache.

To fix this issue we first record number of created FIDs for predefined
buffer, and then skip them explicitly in source manager.

Another solution would be to just give predefined buffers a valid source
location, but it is unclear where that should be..

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78649




More information about the All-commits mailing list