Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
a878dab7
Commit
a878dab7
authored
May 01, 1993
by
Tom Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(build_ivar_reference): Warn when a class method
refers to an instance variable. From-SVN: r4294
parent
257e61ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
gcc/objc/objc-act.c
+14
-1
No files found.
gcc/objc/objc-act.c
View file @
a878dab7
...
...
@@ -4739,7 +4739,20 @@ build_ivar_reference (id)
tree
id
;
{
if
(
TREE_CODE
(
method_context
)
==
CLASS_METHOD_DECL
)
TREE_TYPE
(
self_decl
)
=
instance_type
;
/* cast */
{
/* Historically, a class method that produced objects (factory
method) would assign `self' to the instance that it
allocated. This would effectively turn the class method into
an instance method. Following this assignment, the instance
variables could be accessed. That practice, while safe,
violates the simple rule that a class method should not refer
to an instance variable. It's better to catch the cases
where this is done unknowingly than to support the above
paradigm. */
warning
(
"instance variable `%s' accessed in class method"
,
IDENTIFIER_POINTER
(
id
));
TREE_TYPE
(
self_decl
)
=
instance_type
;
/* cast */
}
return
build_component_ref
(
build_indirect_ref
(
self_decl
,
"->"
),
id
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment