[PATCH] D47698: [ASTImporter] import macro source locations
Rafael Stahl via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 25 01:20:12 PDT 2018
r.stahl marked an inline comment as done.
r.stahl added inline comments.
================
Comment at: lib/AST/ASTImporter.cpp:7058
+ const SrcMgr::ExpansionInfo &FromEx = FromSLoc.getExpansion();
+ SourceLocation ToSpLoc = Import(FromEx.getSpellingLoc());
+ SourceLocation ToExLocS = Import(FromEx.getExpansionLocStart());
----------------
a.sidorin wrote:
> r.stahl wrote:
> > martong wrote:
> > > Let's say we import a `SourceLocation` with `ASTImporter::Import(SourceLocation FromLoc)`.
> > > That calls into `ASTImporter::Import(FileID FromID)` where we again import other source locations.
> > > Could the initial `FromLoc` be equal with any of these locations (`FromEx.getSpellingLoc()`, `FromEx.getExpansionLocStart()`) ?
> > > My understanding is that this is not possible because we cannot have recursive macros, but please confirm.
> > Yes, that was my understanding as well. If some compiler error is a macro expansion it eventually stops at some point while walking this chain.
> If we have a macro referring another macro in the same file, will we import their FileID twice? First, during `Import(getSpellingLoc())` and then in this caller?
That is taken care of by the ImportedFileIDs check.
Repository:
rC Clang
https://reviews.llvm.org/D47698
More information about the cfe-commits
mailing list