Currently when we see a built-in we try and import the include location. Instead what we do now is find the buffer like we do for the invalid case and copy that over to the to context.
martong a.sidorin teemperor aaron.ballman balazske
- rG9adbbcb7cd06: [ASTImporter] Handle built-in when importing SourceLocation and FileID
rC355332: [ASTImporter] Handle built-in when importing SourceLocation and FileID
rL355332: [ASTImporter] Handle built-in when importing SourceLocation and FileID
IsBuiltin = false should be the correct formatting.
The new parameter should be added here too.
The Cache can be moved into this block and the block to else if.
Is it possible that in the isBuiltin true case this part of the code does run (always) without assertion or other error and the result is always an invalid ToID? (If yes the whole change is not needed, so I want to know what was the reason for this change, was there any crash or bug.)
This origin of this fix is the LLDB expression parsing issue. We were not able to reduce to a test we could put in ASTImpoterTest.cpp but we have a LLDB test that exercises this issue and will pass once this fix is in place.
See this differential https://reviews.llvm.org/D58790
I am not sure I understand what you are asking. Do you mean just duplicate the
const SrcMgr::ContentCache *Cache = FromSLoc.getFile().getContentCache();
in both blocks?
This change was the result of a assert where evaluating an expression resulted in the built-in being imported and it would assert in SourceManager when when Import(SourceLocation....) attempted getDecomposedLoc at the next step.
AFAICT the The Preprocessor sets it up the buffer here and then creates the FileID for in the SourceManager and copying over the buffer should be the correct thing to do since that seems to be sufficient.
I also while testing verified that the BufferIndetifer() did indeed equal "<built-in>" similar to this check in SourceManager.