Ted Kremenek [Thu, 20 Mar 2014 06:07:30 +0000 (06:07 +0000)]
[-Wunreachable-code] Simplify and broad -Wunreachable-code-return, including nontrivial returns.
The exception is return statements that include control-flow,
which are clearly doing something "interesting".
99% of the cases I examined for -Wunreachable-code that fired
on return statements were not interesting enough to warrant
being in -Wunreachable-code by default. Thus the move to
include them in -Wunreachable-code-return.
This simplifies a bunch of logic, including removing the ad hoc
logic to look for std::string literals.
Ben Langmuir [Wed, 19 Mar 2014 20:23:34 +0000 (20:23 +0000)]
Add a new spelling for module map files 'module.modulemap'
This name, while more verbose, plays more nicely with tools that use
file extensions to determine file types. The existing spelling
'module.map' will continue to work, but the new spelling will take
precedence.
In frameworks, this new filename will only go in a new 'Modules'
sub-directory.
Similarly, add a module.private.modulemap corresponding to
module_private.map.
Manuel Klimek [Wed, 19 Mar 2014 10:22:36 +0000 (10:22 +0000)]
Use the expansion location of the file name when finding the module.
The spelling location of stringified strings is not a file location.
Optimally, we'll want to solve the problem (as the FIXME states) by
handing in the right FileEntry of the #include location.
Justin Bogner [Tue, 18 Mar 2014 21:58:06 +0000 (21:58 +0000)]
CodeGen: Include a function hash in instrumentation based profiling
The hash itself is still the number of counters, which isn't all that
useful, but this separates the API changes from the actual
implementation of the hash and will make it easier to transition to
the ProfileData library once it's implemented.
Richard Smith [Tue, 18 Mar 2014 20:31:31 +0000 (20:31 +0000)]
In the presence of modules, we can have multiple implicit instantiations of the same template. Teach RecursiveASTVisitor to visit all of those, not just one of them. This is difficult to test by itself, but will be covered by an upcoming change.
Yunzhong Gao [Tue, 18 Mar 2014 17:55:18 +0000 (17:55 +0000)]
Creating a printing policy for "half":
Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for
other languages, error messages and metadata (and hence debug info) should refer
to the half-precision floating point as "__fp16" instead of "half" when
compiling for non-OpenCL languages. This patch creates a new printing policy for
half in a similar manner to what is done for bool and wchar_t.
Objective-C. Better fix for my previous patch
"No need to issue deprecated warning if deprecated method
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335". No functionality change.
Matthew Curtis [Tue, 18 Mar 2014 12:25:27 +0000 (12:25 +0000)]
modify declare-use.S to work when full toolchain not present
Test doesn't actually require production of an object file and for
some targets (e.g. hexagon) an assembler is not always available when
lit tests are run.
Manuel Klimek [Tue, 18 Mar 2014 11:22:45 +0000 (11:22 +0000)]
Fix crasher bug.
Due to not resetting the fake rparen data on the token when iterating
over annotated lines, we would pop the last element of the paren stack.
This patch fixes the underlying root cause, and makes the code more
robust against similar problems in the future:
- reset the first token when iterating on the same annotated lines due
to preprocessor branches
- never pop the last element from the paren stack, so we do not crash,
but rather incorrectly format
- add assert()s so we can figure out if our assumptions are violated
Richard Smith [Tue, 18 Mar 2014 02:07:28 +0000 (02:07 +0000)]
AST dumper: if we have multiple implicit instantiations of the same class
template specialization (from different modules), dump them all, so that every
declaration is dumped somewhere.
Objective-C. No need to issue deprecated warning if deprecated method
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335
Objective-C. Consider blocks for designated initializer
warnings (warning or lack there of) as well since
blocks are another pattern for envoking other
designated initializers. // rdar://16323233
In instrumentation-based profiling, we need a set of data structures to
represent the counters. Previously, these were built up during static
initialization. Now, they're shoved into a specially-named section so
that they show up as an array.
As a consequence of the reorganizing symbols, instrumentation data
structures for linkonce functions are now correctly coalesced.
This is the first step in a larger project to minimize runtime overhead
and dependencies in instrumentation-based profilng. The larger picture
includes removing all initialization overhead and making the dependency
on libc optional.
Aaron Ballman [Mon, 17 Mar 2014 18:10:01 +0000 (18:10 +0000)]
[C++11] Replacing CGFunctionInfo arg iterators with iterator_range arguments(). Updating all of the usages of the iterators with range-based for loops.
Objective-C. Do not warn when an instance method and
class method with the same selctor but different argument
types having one of them in class extension.
// rdar://16312105
Aaron Ballman [Mon, 17 Mar 2014 17:22:27 +0000 (17:22 +0000)]
[C++11] Replacing CallArgList writeback iterators with iterator_range writebacks(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions.
Aaron Ballman [Mon, 17 Mar 2014 17:14:12 +0000 (17:14 +0000)]
[C++11] Replacing DeclContext iterators using_directives_begin() and using_directives_end() with iterator_range using_directives(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. Also used as an opportunity to normalize the name from getUsingDirectives() to using_directives().
Aaron Ballman [Mon, 17 Mar 2014 17:03:37 +0000 (17:03 +0000)]
[C++11] Replacing Scope iterators using_directives_begin() and using_directives_end() with iterator_range using_directives(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions.
Aaron Ballman [Mon, 17 Mar 2014 16:55:25 +0000 (16:55 +0000)]
[C++11] Replacing Scope iterators decl_begin() and decl_end() with iterator_range decls(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions.
Aaron Ballman [Mon, 17 Mar 2014 16:14:00 +0000 (16:14 +0000)]
[C++11] Replacing ObjCObjectPointerType iterators qual_begin() and qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Mon, 17 Mar 2014 15:55:30 +0000 (15:55 +0000)]
[C++11] Replacing ObjCObjectType iterators qual_begin() and qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Mon, 17 Mar 2014 15:38:09 +0000 (15:38 +0000)]
[C++11] Replacing FunctionProtoType iterators exception_begin() and exception_end() with iterator_range exceptions(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Mon, 17 Mar 2014 15:23:01 +0000 (15:23 +0000)]
[C++11] Replacing FunctionProtoType iterators param_type_begin() and param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Mon, 17 Mar 2014 14:19:37 +0000 (14:19 +0000)]
[C++11] Replacing CompoundStmt iterators body_begin() and body_end() with iterator_range body(). Updating all of the usages of the iterators with range-based for loops.
Fix PR18806: Canonicalize the replacement type when deserializing a SubstTemplateTypeParmType
What's going on in the test case (without the patch applied) is this:
When the header is parsed, decltype(B()) is canonicalized to decltype(Y()),
because that was the first parsed equivalent decltype expression. Hence, the
TemplateSpecializationType for Id<decltype(B())> ends up with
SubstTemplateTypeParmType(T, decltype(Y())) as the AliasedType member.
When the PCH file is included and the AST reader reads Id<decltype(B())>, it
sees decltype(B()) before decltype(Y()). So, this time decltype(B()) ends up
being the canonical type for both decltypes, which leads to an assert violation
when the reader calls getSubstTemplateTypeParmType with the non-canonical
decltype(Y()) as the replacement type.
Ted Kremenek [Sat, 15 Mar 2014 05:47:06 +0000 (05:47 +0000)]
Further refine -Wunreachable-code groups so that -Wno-unreachable-code-break doesn't turn off all unreachable code warnings.
Also relax unreachable 'break' and 'return' to not check for being
preceded by a call to 'noreturn'. That turns out to not be so
interesting in practice.
Ted Kremenek [Sat, 15 Mar 2014 01:26:32 +0000 (01:26 +0000)]
Start breaking -Wunreachable-code up into different diagnostic groups.
Recent work on -Wunreachable-code has focused on suppressing uninteresting
unreachable code that center around "configuration values", but
there are still some set of cases that are sometimes interesting
or uninteresting depending on the codebase. For example, a dead
"break" statement may not be interesting for a particular codebase,
potentially because it is auto-generated or simply because code
is written defensively.
To address these workflow differences, -Wunreachable-code is now
broken into several diagnostic groups:
-Wunreachable-code: intended to be a reasonable "default" for
most users.
and then other groups that turn on more aggressive checking:
-Wunreachable-code-break: warn about dead break statements
-Wunreachable-code-trivial-return: warn about dead return statements
that return "trivial" values (e.g., return 0). Other return
statements that return non-trivial values are still reported
under -Wunreachable-code (this is an area subject to more refinement).
-Wunreachable-code-aggressive: supergroup that enables all these
groups.
The goal is to eventually make -Wunreachable-code good enough to
either be in -Wall or on-by-default, thus finessing these warnings
into different groups helps achieve maximum signal for more users.
TODO: the tests need to be updated to reflect this extra control
via diagnostic flags.
Objective-C. Redo turning off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject
have to implement such methods as a common pattern to prevent
user's own implementation. // rdar://16305460
Richard Smith [Fri, 14 Mar 2014 22:07:27 +0000 (22:07 +0000)]
Call RequireCompleteType when performing ADL even if the type is already
complete. We hook into this check from a couple of other places (modules,
debug info) so it's not OK to elide the check if the type was already
complete.
Richard Smith [Fri, 14 Mar 2014 21:21:24 +0000 (21:21 +0000)]
Add two missing entries to the C++11 support page. Bump one relevant diagnostic
(for an integer too large for any signed type) from Warning to ExtWarn -- it's
ill-formed in C++11 and C99 onwards, and UB during translation in C89 and
C++98. Add diagnostic groups for two relevant diagnostics.
Aaron Ballman [Fri, 14 Mar 2014 20:59:21 +0000 (20:59 +0000)]
[C++11] Removing the local_import_begin() and local_import_end() APIs and replacing with a range-only local_imports() API. Privatizes the iterator class as well.
Objective-C. Turn off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject
have to implement such methods as a common pattern to prevent
user's own implementation. // rdar://16305460
Richard Smith [Fri, 14 Mar 2014 20:26:09 +0000 (20:26 +0000)]
Try to remove confusion about C++11 feature support:
* Explicitly say that we conform to the two N/A bullets that required no
compiler changes.
* Remove a library feature from our features list.
Aaron Ballman [Fri, 14 Mar 2014 19:41:04 +0000 (19:41 +0000)]
[C++11] Replacing CapturedStmt iterators capture_init_begin() and capture_init_end() with iterator_range capture_inits(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 18:34:04 +0000 (18:34 +0000)]
[C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with iterator_range captures(). Updating all of the usages of the iterators with range-based for loops.
Objective-C. Allow objc_designated_initializer for private
initializers; but only those declared in class extensions
(not in implementations). // rdar://16305347
Aaron Ballman [Fri, 14 Mar 2014 18:08:33 +0000 (18:08 +0000)]
[C++11] Replacing CapturedStmt iterators capture_begin() and capture_end() with iterator_range captures(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 17:01:24 +0000 (17:01 +0000)]
[C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with iterator_range decls(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 16:29:14 +0000 (16:29 +0000)]
[C++11] Replacing VarTemplateDecl iterators spec_begin() and spec_end() with iterator_range specializations(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 16:13:33 +0000 (16:13 +0000)]
[C++11] Replacing ClassTemplateDecl iterators spec_begin() and spec_end() with iterator_range specializations(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 16:05:56 +0000 (16:05 +0000)]
[C++11] Replacing FunctionTemplateDecl iterators spec_begin() and spec_end() with iterator_range specializations(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 14 Mar 2014 15:55:35 +0000 (15:55 +0000)]
[C++11] Replacing OMPThreadPrivateDecl and OMPClause iterators varlist_begin() and varlist_end() with iterator_range varlists(). Updating all of the usages of the iterators with range-based for loops.
Objective-C++ IRGen. Due to change to AST for initialization of c++11’s
data members by addition of CXXDefaultInitExpr node to the initializer expression,
it has broken treatment of arc code for such initializations. Reviewed by John McCall.
// rdar://16299964