[PCH] Make sure that all newly introduced visible decls in a DeclContext
coming from an AST file are registered for serialization.
A static data member instantiation of in a chained PCH could be missed
when serializing decls; the result was that when emitting the visible decls
map of its DeclContext, we would use a DeclID that was not actually emitted,
leading to crashes or hangs.
Fix this by making sure such decls are always registered for serialization.
Also introduce extra sanity checks to make sure we don't register new
declarations or types after we have serialized the types/decls block.
Dmitri Gribenko [Mon, 2 Jul 2012 17:35:10 +0000 (17:35 +0000)]
Add a new libclang completion API to get brief documentation comment that is
attached to a declaration in the completion string.
Since extracting comments isn't free, a new code completion option is
introduced.
A new code completion option that enables including brief comments
into CodeCompletionString should be a, err, code completion option.
But because ASTUnit caches global declarations during parsing before
even completion consumer is created, the option is duplicated as a
translation unit option (in both libclang and ASTUnit, like the option
to cache code completion results).
James Dennett [Mon, 2 Jul 2012 07:01:42 +0000 (07:01 +0000)]
Documentation cleanup: reformatting/fixing up file comments so that they have
\file and \brief markup and appear in Doxygen's summaries (and eventually at
http://clang.llvm.org/doxygen/files.html). Fixed up another couple of minor
glitches in the docs at the same time.
Richard Smith [Mon, 2 Jul 2012 06:15:40 +0000 (06:15 +0000)]
Additional testing for fixes in r158289 and r158290 to allow implicitly-declared
constructors for non-literal types to be constexpr in some circumstances.
For some targets a structure named __va_list_tag is built to help define
the __builtin_va_list type. However, __va_list_tag was not being treated as a
predefined type thus causing problems when serializing the AST. This commit
fixes that oversight by adding the necessary support to treat __va_list_tag
as a predefined type.
Jordan Rose [Sat, 30 Jun 2012 21:33:57 +0000 (21:33 +0000)]
Add support for the C11 _Alignof keyword.
This behaves like the existing GNU __alignof and C++11 alignof keywords;
most of the patch is simply adding the third token spelling to various places.
Chandler Carruth [Sat, 30 Jun 2012 10:14:27 +0000 (10:14 +0000)]
Switch Clang to use the new common LLVM CMake infrastructure for adding
lit testsuites. This sinks all management of the aggregate lit runs into
the LLVM CMake files, making Clang only responsible for declaring its
own testsuite. In the process we fix numerous "bugs" where the proper
method of invoking lit has changed over time, and the old system
encoded several broken artifacts of this in ABIs and compatibility
tests.
It also switches to 'check-clang' for the canonical name of the test
suite, although 'clang-test' remains as an alias.
The situation when Clang is being built in standalone mode is little
changed. It replicates just enough of the lit setup to cope with the
oddities of being run outside of an LLVM build.
David Blaikie [Fri, 29 Jun 2012 22:03:56 +0000 (22:03 +0000)]
Use -frewrite-includes for crash reports.
In future changes we should:
* use __builtin_trap rather than derefing 'random' volatile pointers.
* avoid dumping temporary files into /tmp when running tests, instead
preferring a location that is properly cleaned up by lit.
Richard Trieu [Fri, 29 Jun 2012 21:12:16 +0000 (21:12 +0000)]
Update the %diff modifer to have an alternate string print when a template tree
is selected. This will allow more flexibility when converting diagnostics to
use template type diffing.
Also updated the internal manual and test cases for correctly keeping the bold
attribute and for tree printing.
Ted Kremenek [Fri, 29 Jun 2012 20:44:58 +0000 (20:44 +0000)]
Tweak insecureAPI analyzer checks to have the ability to be individually disabled.
The solution is a bit inefficient: it creates N checkers, one for each check, and
each check does a dispatch on the function name. This is redundant, but we can fix
this once we have the proper ability to enable/disable subchecks.
objective-c modern translator: synthesize argument type
correctly for blocks and function pointer arguments
in the written constructor. // rdar://11359268
objective-c modern translator: Translation into objc_msgSend_stret
entry point which requires nil check before calling objc_msgSend_stret.
// rdar://11359268 - wip.
Axel Naumann [Fri, 29 Jun 2012 07:30:33 +0000 (07:30 +0000)]
From Philippe Canal:
Update the two function overloads
void TemplateSpecializationType::PrintTemplateArgumentList(raw_ostream &OS,....
to behave like
std::string TemplateSpecializationType::PrintTemplateArgumentList(const TemplateArgument *Args,...
hence making sure that clang consistently adds a space between two '>' at the end of nested template arguments.
Douglas Gregor [Fri, 29 Jun 2012 01:05:22 +0000 (01:05 +0000)]
When a builtin that requires a constant is given a type- or
value-dependent expression, don't complain that it wasn't the constant
we wanted. Fixes <rdar://problem/11688587> and PR11074.
Manman Ren [Fri, 29 Jun 2012 00:54:35 +0000 (00:54 +0000)]
X86: add more GATHER intrinsics in Clang
Corrected type for index of _mm256_mask_i32gather_pd
from 256-bit to 128-bit
Corrected types for src|dst|mask of _mm256_mask_i64gather_ps
from 256-bit to 128-bit
Support the following intrinsics:
_mm_mask_i32gather_epi64, _mm256_mask_i32gather_epi64,
_mm_mask_i64gather_epi64, _mm256_mask_i64gather_epi64,
_mm_mask_i32gather_epi32, _mm256_mask_i32gather_epi32,
_mm_mask_i64gather_epi32, _mm256_mask_i64gather_epi32
Douglas Gregor [Fri, 29 Jun 2012 00:49:17 +0000 (00:49 +0000)]
Teach the __is_trivially_assignable and __is_trivially_constructible
type traits that assignment to/construction of a lifetime-qualified
object under ARC is *not* trivial. Fixes <rdar://problem/11738725>.
Jordan Rose [Fri, 29 Jun 2012 00:33:10 +0000 (00:33 +0000)]
[analyzer] Add a test that we are, in fact, doing a DFS on the ExplodedGraph.
Previously:
...the comment said DFS...
...the WorkList being instantiated said BFS...
...and the implementation was actually DFS...
...due to an unintentional change in 2010...
...and everything kept working anyway.
This fixes our std::deque implementation of BFS, but switches back to a
SmallVector-based implementation of DFS.
We should probably still investigate the ramifications of DFS vs. BFS,
especially for large functions (and especially when we hit our block path
limit), since this might completely change our memory use. It can also mask
some bugs and reveal others depending on when we halt analysis. But at least
we will not have this kind of little mistake creep in again.
Benjamin Kramer [Thu, 28 Jun 2012 20:08:55 +0000 (20:08 +0000)]
Dead code eliminate the massive hexagon builtin intrinsic supporting code.
The tablegen'd code does the same thing without this egregious duplication.
In my limited testing everything seems to work, however there can be
differences if the clang and llvm builtin definitions don't match.
Rafael Espindola [Thu, 28 Jun 2012 14:28:57 +0000 (14:28 +0000)]
Don't devirtualize calls when we don't have the correct type of the this pointer
handy. It can be done, but we would have to build a derived-to-base cast
during codegen to compute the correct this pointer.
Richard Smith [Thu, 28 Jun 2012 07:51:56 +0000 (07:51 +0000)]
Add warning flag -Winvalid-pp-token for preprocessing-tokens which have
undefined behaviour, and move the diagnostic for '' from an Error into
an ExtWarn in this group. This is important for some users of the preprocessor,
and is necessary for gcc compatibility.
Rafael Espindola [Thu, 28 Jun 2012 01:56:38 +0000 (01:56 +0000)]
Fix another issue with devirtualizing calls to final methods by passing them
the correct this pointer. There is some potential for sharing a bit more
code with canDevirtualizeMemberFunctionCalls, but that can be done in an
independent patch.
Richard Smith [Wed, 27 Jun 2012 20:23:58 +0000 (20:23 +0000)]
Check for non-POD vararg argument type after default argument promotion, not
before, so we don't incorrectly think arguments of function type are non-POD.
Dmitri Gribenko [Wed, 27 Jun 2012 16:53:58 +0000 (16:53 +0000)]
Remove unsigned and a pointer from a comment token (so that each token can have only one semantic string value attached to it), at a cost of adding an additional token.
Dmitri Gribenko [Wed, 27 Jun 2012 16:30:35 +0000 (16:30 +0000)]
Comment lexer: counting backwards from token end is thought to be confusing. We already have a pointer to the beginning of the token, so use it to extract the text instead.
Chandler Carruth [Wed, 27 Jun 2012 10:06:26 +0000 (10:06 +0000)]
Remove a completely unused and remarkably inaccurate list of test
directories from the cmake file. Dunno what the history is here, but
we're not using it.
Axel Naumann [Wed, 27 Jun 2012 09:17:42 +0000 (09:17 +0000)]
From Vassil Vassilev:
add interface for removing a FileEntry from the cache.
Forces a re-read the contents from disk, e.g. because a tool (like cling) wants to pick up a modified file.
Add a few (currently failing) tests for the PR13207 (template mangling in the presence of back references).
I've added an extra FileCheck pass for that with an extra "CURRENT" prefix.
I've carefully chosed the CURRENT/CORRECT prefixes so they
a) are self-descriptive
b) have the same length so the mangling between the current and the correct version is obvious
Feel free to ask me to change the prefixes if you know a better alternative.