[PATCH] D106394: [clang][pp] adds '#pragma include_instead'
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 27 08:30:36 PDT 2021
hans added a comment.
This is causing the compiler to crash in Chromium builds, see https://bugs.chromium.org/p/chromium/issues/detail?id=1195353
I verified that replacing the use of getLiteralData() with OriginalFileName in HandleHeaderIncludeOrImport() fixes the crash, but the the other getLiteralData() probably needs a fix too, and I don't have a test case, so reverted for now in 973de7185606a21fd5e9d5e8c014fbf898c0e72f <https://reviews.llvm.org/rG973de7185606a21fd5e9d5e8c014fbf898c0e72f>
================
Comment at: clang/lib/Lex/PPDirectives.cpp:2028
+ CurLexer->addInclude(
+ {FilenameTok.getLiteralData(), FilenameTok.getLength()},
+ File->getFileEntry(), FilenameLoc);
----------------
getLiteralData() can return null, which causes a crash here in Chromium.
I think getSpelling() should be used instead, and since it was already called above, perhaps you could just pass in OriginalFilename here.
================
Comment at: clang/lib/Lex/Pragma.cpp:571
+ TheLexer->getFileEntry(),
+ {FilenameTok->getLiteralData(), FilenameTok->getLength()});
+}
----------------
actually, get getSpelling() is probably necessary in case getLiteralData() returns null?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106394/new/
https://reviews.llvm.org/D106394
More information about the cfe-commits
mailing list