...by synthesizing their body to be "return self->_prop;", with an extra
nudge to RetainCountChecker to still treat the value as +0 if we have no
other information.
This doesn't handle weak properties, but that's mostly correct anyway,
since they can go to nil at any time. This also doesn't apply to properties
whose implementations we can't see, since they may not be backed by an
ivar at all. And finally, this doesn't handle properties of C++ class type,
because we can't invoke the copy constructor. (Sema has actually done this
work already, but the AST it synthesizes is one the analyzer doesn't quite
handle -- it has an rvalue DeclRefExpr.)
Modeling setters is likely to be more difficult (since it requires
handling strong/copy), but not impossible.
<rdar://problem/11956898>
llvm-svn: 198953
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134
llvm-svn: 198952
With this change tok::code_completion is finally handled exclusively as a
special token kind like other tokens that need special treatment.
All callers have been updated to use the specific token consumption methods and
the parser has a clear idea the current token isn't special by the time
ConsumeToken() gets called, so this has been unreachable for some time.
ConsumeAnyToken() behaviour is unchanged and will continue to support
unexpected code completion as part of the special token path.
This survived an amount of fuzzing and validation, but please ping the list if
you hit a code path that previously relied on the old unexpected handler and
now asserts.
llvm-svn: 198942
Based on recent discussions, attempt to provide a clearer distinction between
MicrosoftMode and MicrosoftExt. This still doesn't feel perfect but gives a
better idea which is which.
Also update the CPlusPlus11 description which got missed in r171367.
C++0x is dead, long live C++0x!
llvm-svn: 198936
Before:
SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]
.insert(ccccccccccccccccccccccc);
After:
SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)].insert(
ccccccccccccccccccccccc);
This seems to be about 3:1 more common in Google and Chromium style and I found
only a handful of instances inside the LLVM codebase.
llvm-svn: 198924
__declspec(align), when applied to bitfields affects their perferred
alignment instead of their required alignment. We don't know why.
Also, #pragma pack(n) turns packing *off* if n is greater than the
pointer size. This is now observable because of the impact of
declspec(align) on bitfields.
llvm-svn: 198907
property has the naming convention that implies 'ownership'.
2) improve on diagnostic and make it property specific.
3) fix the line number in the case of default property
synthesis. // rdar://15757510
llvm-svn: 198905
just valid C++11 =)
Original commit message:
PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on
SPARC, where uint64_t apparently requires higher alignment than void*.
llvm-svn: 198903
The MS abi lays out *all* non-virtual bases with leading vfptrs before
laying out non-virutal bases without vfptrs. This guarantees that the
primary base is laid out first. r198818 fixed RecordLayoutBuilder to
produce compatiable layouts. This patch fixes CGRecordLayoutBuilder to
be able to consume those layouts and produce meaningful output without
tripping any asserts about assumed incoming layout.
A test case is included that shows CGRecordLayoutBuilder in fact
produces output in the compatiable order.
llvm-svn: 198900
Preserves the setting of -fretain-comments-from-system-headers when
building/saving/loading module files. This allows code completion to pick up
documentation comments from system modules.
llvm-svn: 198890
Fixes <rdar://problem/15596883>
In ARC, __attribute__((objc_precise_lifetime)) guarantees that the
object stored in it will survive to the end of the variable's formal
lifetime. It is therefore useful even if it completely unused.
llvm-svn: 198888
To declare or define reserved identifers is undefined behaviour in standard
C++. This needs to be addressed in compiler-rt before it can be used in LLVM.
See the list discussion for details.
This reverts commit r198858.
llvm-svn: 198885
While it is allowed to not have an @ on subsequent lines, it seems
general practice to add them. If undesired, the code author can easily
remove them again and clang-format won't re-add them.
llvm-svn: 198871
Before:
#pragma mark Any non - hyphenated or hyphenated string(including parentheses).
After:
#pragma mark Any non-hyphenated or hyphenated string (including parentheses).
llvm-svn: 198870
- Format a braced list with one element per line if it has nested
braced lists.
- Use a column layout only when the list has 6+ elements (instead of the
current 4+ elements).
llvm-svn: 198869
from the global address space (6.5.1 of the OpenCL 1.2 specification).
This makes clang construct the image arguments in the global address
space and generate the argument metadata with the correct address space
descriptor.
Patch by Pedro Ferreira!
llvm-svn: 198868
LLVM's Value interface which is used in LLVM's DominatorTree analysis
and which changed in LLVM r198836.
The DominatorTree analysis is actually a generic graph analysis and
should be moved to LLVM's support library to clarify that Clang and
others are using it with arbitrary graphs. Further, it seems likely that
it should be using something other than printAsOperand, but this is
a simpler build fix. I'll clean this up later.
llvm-svn: 198840
issue 1430. Don't allow a pack expansion to be used as an argument to an alias
template unless the corresponding parameter is a parameter pack.
llvm-svn: 198833
This patch refactors microsoft record layout to be more "natural". The
most dominant change is that vbptrs and vfptrs are injected after the
fact. This simplifies the implementation and the math for the offest
for the first base/field after the vbptr.
llvm-svn: 198818
It's not worth keeping two copies of the identifier init and comparison code
just to save a pointer coparison.
This should reduce further once we get proper contextual keywords in the token
stream, so having the identifier checks in one place is a step towards that.
Cleanup only.
llvm-svn: 198814
We (perhaps over-cautiously) disable the new plugin tests on static Windows
builds right now, matching what LLVM core does. This change was needed for the
lit check to work.
Thanks to Warren Hunt for spotting this.
llvm-svn: 198782
...rather somewhere in the destructor when we try to access something and
realize the object has already been deleted. This is necessary because
the destructor is processed before the 'delete' itself.
Patch by Karthik Bhat!
llvm-svn: 198779
Convert CMake CLANG_BUILD_EXAMPLES to a boolean value for consumption by
Python, otherwise the raw config string gets passed through which may not be
0/1.
The if/else matches the technique used to solve the problem in LLVM's own
CMakeLists.txt.
llvm-svn: 198750
Somehow the entire plugin infrastructure went wholly untested until now.
The only plugins available for use in testing are the examples, so plugin tests
will only be run if CLANG_BUILD_EXAMPLES is enabled in the build.
(The examples should really be enabled by default, not just to aid testing but
also to prevent bitrot in some key user-facing code. I'll propose that
shortly.)
Requires supporting changes in LLVM r198746.
llvm-svn: 198747
type-specifier in C++. Some checks will assert in this case otherwise (in
particular, the access specifier may be missing if this happens inside a class
definition, due to a violation of an AST invariant).
llvm-svn: 198721
Debug info: Implement a cleaner version of r198461. For symmetry with
C and C++ don't emit an extra lexical scope for the compound statement
that is the body of an Objective-C method.
llvm-svn: 198715
...even though the argument is declared "const void *", because this is
just a way to pass pointers around as objects. (Though NSData is often
a better one.)
PR18262
llvm-svn: 198710
RetainCountChecker has to track returned object values to know if they are
retained or not. Under ARC, even methods that return +1 are tracked by the
system and should be treated as +0. However, this effect behaves exactly
like NotOwned(ObjC), i.e. a generic Objective-C method that actually returns
+0, so we don't need a special case for it.
No functionality change.
llvm-svn: 198709
In SVN checkouts, clang_revision_tag is rerun on every build, even if nothing
else is dirty. After this change, Version.inc is only written at cmake time,
so that empty builds run 0 build steps (like r191784 apparently did for git).
llvm-svn: 198704
C and C++ don't emit an extra lexical scope for the compound statement
that is the body of an Objective-C method.
rdar://problem/15010825
llvm-svn: 198699
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.
llvm-svn: 198686
This backs out changes in commit r198605 and part of r198604, replacing the
original tok::kw_template with a slightly more obvious placeholder
tok::unknown.
llvm-svn: 198666
It controls everything that -flimit-debug-info used to, plus the
vtable type optimization. The old -fno-limit-debug-info option is now an
alias to -fstandalone-debug and vice versa.
Standalone is the default on Darwin until dtrace is updated to work with
non-standalone debug info (rdar://problem/15758808).
Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind
because NoStandaloneDebugInfo sounded even more confusing.
llvm-svn: 198655
This matches up the underlying type against the actual storage type 'unsigned
short' and lets us get rid of some casts while we're at it.
Effort is made to keep this building in pre-C++11 but as with other features
Token will be less efficiently packed in in legacy configurations.
llvm-svn: 198607
Implemented with a new getKeywordSpelling() accessor. Unlike getTokenName() the
result of this function is stable and may be used in diagnostic output.
Uses of this feature are split out into the subsequent commit.
llvm-svn: 198604
enum-scoped.cpp:93:6: error: enumeration redeclared with different underlying type 'short' (was 'int')
enum Redeclare6 : short;
^
enum-scoped.cpp:92:6: note: previous declaration is here
enum Redeclare6 : int;
^ ~~~
The redeclaration source range is still missing but this is a step forward,
potentially edging towards a FixIt.
llvm-svn: 198601
In all three checks, the note indicates a previous declaration and never a 'use'.
Before:
enum-scoped.cpp:92:6: note: previous use is here
enum Redeclare6 : int;
^
After:
enum-scoped.cpp:92:6: note: previous declaration is here
enum Redeclare6 : int;
^
llvm-svn: 198600
Before:
enum ShortEnum {
A,
B,
C
};
After:
enum ShortEnum { A, B, C };
This seems to be the predominant choice in LLVM/Clang as well as in
Google style.
llvm-svn: 198558
It was previously enabled in both but should only have been part of the drop-in
quirks mode that is 'MicrosoftMode' given that it's only useful for
compatibility with the Microsoft headers/runtime.
llvm-svn: 198548
Cover a hypothetical case when we might not have reached the final argument
declaration for some reason during recovery, and split out for readability.
llvm-svn: 198542
void knrNoSemi(i) int i { }
Adherents of The C Programming Language unfortunate enough to miss a semicolon
as above would be met with a cascade of errors spanning the remainder of the
TU.
This patch introduces a beautiful parse error recovery, complete with helpful
FixIt to restore sanity.
Before (output redacted for brevity):
error: 'error' diagnostics seen but not expected:
File declarators.c Line 119: declaration does not declare a parameter
File declarators.c Line 123: declaration does not declare a parameter
File declarators.c Line 127: parameter named 'func_E12' is missing
File declarators.c Line 127: expected ';' at end of declaration
File declarators.c Line 133: parameter named 'func_E13' is missing
File declarators.c Line 133: expected ';' at end of declaration
File declarators.c Line 139: parameter named 'func_E14' is missing
File declarators.c Line 139: expected ';' at end of declaration
File declarators.c Line 145: parameter named 'func_E15' is missing
File declarators.c Line 145: expected ';' at end of declaration
File declarators.c Line 150: expected function body after function declarator
File declarators.c Line 119: declaration of 'enum E11' will not be visible outside of this function
File declarators.c Line 123: declaration of 'enum E12' will not be visible outside of this function
File declarators.c Line 133: ISO C forbids forward references to 'enum' types
File declarators.c Line 133: declaration of 'enum E13' will not be visible outside of this function
File declarators.c Line 139: ISO C forbids forward references to 'enum' types
File declarators.c Line 139: declaration of 'enum E14' will not be visible outside of this function
File declarators.c Line 145: ISO C forbids forward references to 'enum' types
File declarators.c Line 145: declaration of 'enum E15' will not be visible outside of this function
...
After:
declarators.c:103:24: error: expected ';' at end of declaration
void knrNoSemi(i) int i { }
^
;
Patch found in a sealed envelope dated 1978 with the message "Do not open until
January 2014"
llvm-svn: 198540
type_info has been made an implicitly predeclared type in r198497 and will no
longer appear as a user-declared type so we can remove this old hack.
This reverts commit r158595.
llvm-svn: 198502
Instead of keeping it in amongst the macros, build the declaration at Sema init
the same way we do with other predeclared and builtin types.
In practice this means the declaration is marked implicit and therefore won't
show up as an unwanted user-declared type in tooling which has been a
frequently reported issue (though I haven't been able to cook up a test).
llvm-svn: 198497
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.
Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:
/// \brief Mark debug helper function definitions like dump() that should not be
/// stripped from debug builds.
Requires corresponding macro added in LLVM r198456.
llvm-svn: 198489
This checker has not been updated to work with interprocedural analysis,
and actually contains both logical correctness issues but also
memory bugs. We can resuscitate it from version control once there
is focused interest in making it a real viable checker again.
llvm-svn: 198476
consideration the num-of-elements*width-of-element width.
Disallow casts when such width is not equal between the vector types otherwise
we may end up with an invalid LLVM bitcast.
rdar://15722308.
llvm-svn: 198474
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.
Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record. By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal. Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.
Reviewers: majnemer
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2509
llvm-svn: 198462
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.
rdar://15727325
llvm-svn: 198432
Summary:
This allows for a better alternative to the FrontendAction hack used in
clang-tidy in order to get static analyzer's ASTConsumer.
Reviewers: jordan_rose, krememek
Reviewed By: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2505
llvm-svn: 198426