[PATCH] D158293: [NFC][CLANG] Fix potential dereferencing of null return values
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 18 09:35:08 PDT 2023
Manna created this revision.
Manna added reviewers: aaron.ballman, tahonermann.
Herald added projects: All, clang, clang-format.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
Manna requested review of this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158293
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Lex/PPDirectives.cpp
Index: clang/lib/Lex/PPDirectives.cpp
===================================================================
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -547,7 +547,7 @@
} SkippingRangeState(*this);
while (true) {
- if (CurLexer->isDependencyDirectivesLexer()) {
+ if (CurLexer && CurLexer->isDependencyDirectivesLexer()) {
CurLexer->LexDependencyDirectiveTokenWhileSkipping(Tok);
} else {
SkippingRangeState.beginLexPass();
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2006,7 +2006,7 @@
Current.setType(TT_LambdaArrow);
} else if (Current.is(tok::arrow) && AutoFound &&
(Line.MightBeFunctionDecl || Line.InPPDirective) &&
- Current.NestingLevel == 0 &&
+ Current.NestingLevel == 0 && Current.Previous &&
!Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) {
// not auto operator->() -> xxx;
Current.setType(TT_TrailingReturnArrow);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158293.551552.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230818/57b2db35/attachment-0001.bin>
More information about the cfe-commits
mailing list