This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add cxx scope if needed for requires clause.
ClosedPublic

Authored by luken-google on Aug 23 2022, 2:51 PM.

Details

Summary

Fixes issue #55216.

Diff Detail

Event Timeline

luken-google created this revision.Aug 23 2022, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2022, 2:51 PM
luken-google requested review of this revision.Aug 23 2022, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2022, 2:51 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Fix clang-format errors

Note that the following tests:

Builtins-i386-linux :: muldc3_test.c
SanitizerCommon-asan-i386-Linux :: Linux/crypt_r.cpp
SanitizerCommon-asan-i386-Linux :: Posix/crypt.cpp
SanitizerCommon-lsan-i386-Linux :: Linux/crypt_r.cpp
SanitizerCommon-lsan-i386-Linux :: Posix/crypt.cpp
SanitizerCommon-ubsan-i386-Linux :: Linux/crypt_r.cpp
SanitizerCommon-ubsan-i386-Linux :: Posix/crypt.cpp

Are failing at HEAD and at this base diff without this patch.

Thanks for the fix. This looks ok to me, except that I am a bit suspicious of the fact that DeclaratorScopeObj is used somewhat rarely.
I suspect we might want a different guard class for this, e.g. something similar to InitializerScopeRAII.
But I do not enough of the details for the corresponding code to know what the implications of these choices are.

@aaron.ballman could you PTAL or suggest someone who can help review this change?

clang/lib/Parse/ParseTemplate.cpp
294–299

Merging ifs should produce simpler code.

aaron.ballman added reviewers: erichkeane, Restricted Project.Aug 25 2022, 8:49 AM

FWIW, I think this looks correct as well. I've added some reviewers just in case there's something I've missed regarding concepts.

clang/lib/Parse/ParseTemplate.cpp
293–301

Can simplify even further with a new local.

Also, don't forget to add a release note since this is fixing an issue.

Like @ilya-biryukov , I don't really know enough of the uses of 'DeclaratorScopeObj ' to know if that is right, but other than Aaron's suggestions, I don't see anything to suggest.

Responding to feedback.

luken-google marked 2 inline comments as done.Aug 25 2022, 9:29 AM

Thanks for the feedback and the code review. I've uploaded a new revision with the requested changes, PTAL.

erichkeane added inline comments.Aug 25 2022, 9:32 AM
clang/lib/Parse/ParseTemplate.cpp
293

Not sure about this type, should this be a reference?

luken-google retitled this revision from Add cxx scope if needed for requires clause. to [clang] Add cxx scope if needed for requires clause..

Make ScopeSpec a reference.

clang/lib/Parse/ParseTemplate.cpp
293

Mm, good point. Fixed.

luken-google marked an inline comment as done.Aug 25 2022, 10:40 AM
aaron.ballman accepted this revision.Aug 25 2022, 11:29 AM

LGTM! Do you need someone to commit on your behalf? If so, what name and email address would you like used for patch attribution?

clang/docs/ReleaseNotes.rst
177
clang/lib/Parse/ParseTemplate.cpp
293

Great catch!!

This revision is now accepted and ready to land.Aug 25 2022, 11:29 AM

Yes please, I'm hoping to earn committer rights with a series of C++20 patches :).
Name is Luke Nihlen, email is luken@google.com, github ID is luken-google@.

Thanks!

I will commit this on behalf of Luke.

This revision was automatically updated to reflect the committed changes.