Skip to content

Clang issue445#506

Merged
sxl463 merged 16 commits into
masterfrom
clang-issue445
Jun 28, 2018
Merged

Clang issue445#506
sxl463 merged 16 commits into
masterfrom
clang-issue445

Conversation

@sxl463

@sxl463 sxl463 commented Jun 19, 2018

Copy link
Copy Markdown
Contributor

Add features for handling two additional cases:

  • an unchecked pointer in a checked scope with a bounds expression.
  • an integer type with a bounds expression.

Testing passed:
DevTest Release Linux X64 LNT testing
DevTest Debug X64 Linux
DevTest Debug X64 Windows

@sxl463 sxl463 requested a review from dtarditi June 19, 2018 20:29

@dtarditi dtarditi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you cover these cases for members of struct types also?

Please add some tests for the new cases to your pull request for the checkedc repo.

Thanks,
David

@dtarditi dtarditi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I have some formatting suggestions.

Comment thread include/clang/AST/Type.h Outdated
enum CheckedValueKind {
NoCheckedValue,
HasCheckedValue,
HasUnCheckedPointer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the case of the C in HasUnCheckedPointer to lower case (HasUncheckedPointer)? This matches the capitalization in the rest of the code base.

Comment thread lib/AST/Type.cpp Outdated
}
}

// containsCheckedValue - check whether a field type is a checked type or is a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to be updated.

Comment thread lib/Sema/SemaDecl.cpp Outdated
// This is a valid initialization value, so we don't have to issue an
// error message for them.
if (!Var->isInvalidDecl() && Var->hasLocalStorage() &&
if (!Var->isInvalidDecl() && Var->hasLocalStorage() &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added a space at the end of the line. Could you remove the space?

Comment thread lib/AST/Type.cpp Outdated
return Type::NoCheckedValue;

Type::CheckedValueKind hasCheckedField = Type::NoCheckedValue;
// if this is a struct/union type, iterate all its members

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording suggestion: iterate all -> iterate over all

Comment thread lib/Sema/SemaDecl.cpp Outdated
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this white space change?

@dtarditi dtarditi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think the wording in error messages related to integers needs to be clarified.


def err_initializer_expected_for_ptr : Error<
"automatic variable %0 with _Ptr type must have initializer">;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the name integer in place of int in the error messages.

@sxl463 sxl463 merged commit 27e66ca into master Jun 28, 2018
@dtarditi dtarditi deleted the clang-issue445 branch June 29, 2018 21:39
sulekhark pushed a commit that referenced this pull request Jul 8, 2021
The code for deciding if a function should get an itype was duplicated
for function declarations and function pointer types. The function
pointer version of the code had a bug in it that caused issue #498.
The duplicated code has been extracted into a pair of functions that are
reused for functions and function pointers.

A lot of the lines changed in this PR are caused by an EnvironmentMap&
parameter being changed to Constraints&. This lets the function pointer
code call solutionEqualTo which is needed for correct itype insertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants