This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Update cert-err58-cpp to match its new generalised form.
ClosedPublic

Authored by malcolm.parsons on Oct 24 2016, 1:41 PM.

Event Timeline

malcolm.parsons retitled this revision from to [clang-tidy] Update cert-err58-cpp to match its new generalised form..
malcolm.parsons updated this object.
malcolm.parsons added a reviewer: aaron.ballman.
malcolm.parsons added a subscriber: cfe-commits.
aaron.ballman edited edge metadata.Oct 24 2016, 2:21 PM

Thank you for working on this! I have a few more test cases to try, but I think you're already handling them properly.

test/clang-tidy/cert-static-object-exception.cpp
29

We should also have a test for implicitly-provided constructors, since those are noexcept if the data members all have noexcept constructors. Something like:

struct Y {
  S s;
};

Y y; // Diagnose

struct Z {
  T t;
};

Z z; // Do not diagnose
78

Let's also make sure that we're properly catching conversion operators with a test like:

struct UserConv_Bad {
  operator int() noexcept(false);
};

struct UserConv_Good {
  operator int() noexcept;
};

UserConv_Bad some_bad_func();
UserConv_Good some_good_func();

int l = some_bad_func(); // Diagnose
int m = some_good_func(); // Do not diagnose
malcolm.parsons edited edge metadata.

Add more tests.

aaron.ballman accepted this revision.Oct 26 2016, 2:56 PM
aaron.ballman edited edge metadata.

LGTM, thank you!

This revision is now accepted and ready to land.Oct 26 2016, 2:56 PM
malcolm.parsons edited edge metadata.

Add tests for operator new with FIXME comment.

Check calls to operator new.

This revision was automatically updated to reflect the committed changes.