Chandler Carruth [Sat, 29 Dec 2012 12:01:08 +0000 (12:01 +0000)]
Try to re-structure the GCCVersion comparison routine to make it easier
to read and tell that it is a SWO -- we now descend through the
components and return a result at the first inequal component.
Also comment it a bit better and make it a total ordering by sorting on
the text of the suffix if necessary.
Rafael Espindola [Fri, 28 Dec 2012 14:21:58 +0000 (14:21 +0000)]
Reject overloading of two static extern C functions.
This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods
so that they can be used from SemaOverload.cpp and then fixes the logic
in Sema::IsOverload.
David Blaikie [Fri, 28 Dec 2012 01:16:31 +0000 (01:16 +0000)]
Change this to an IR test instead of an assembly test (as per comment in r171134).
This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).
Rafael Espindola [Wed, 26 Dec 2012 04:38:44 +0000 (04:38 +0000)]
Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.
Richard Smith [Tue, 25 Dec 2012 21:56:27 +0000 (21:56 +0000)]
Produce an actual error before attempting to attach notes to it when bailing out
due to FORCE_CLANG_DIAGNOSTICS_CRASH=1. Also add a test for that env var.
Erik Verbruggen [Tue, 25 Dec 2012 14:51:39 +0000 (14:51 +0000)]
Fix for PR12222.
Changed getLocStart() and getLocEnd() to be required for Stmts, and make
getSourceRange() optional. The default implementation for getSourceRange()
is build the range by calling getLocStart() and getLocEnd().
Rafael Espindola [Tue, 25 Dec 2012 07:31:49 +0000 (07:31 +0000)]
Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.
Original message:
Cache visibility of decls.
This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.
Rafael Espindola [Tue, 25 Dec 2012 00:39:58 +0000 (00:39 +0000)]
Cache visibility of decls.
This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.
Daniel Jasper [Mon, 24 Dec 2012 16:51:15 +0000 (16:51 +0000)]
Let clang-format format itself.
Apply all formatting changes that clang-format would apply to its own source
code. All choices seem to improve readability (or at least not make it worse).
No functional changes.
Daniel Jasper [Mon, 24 Dec 2012 16:43:00 +0000 (16:43 +0000)]
Penalize tokens with a lower parenthesis level than the start of the line.
This prevents formattings like this (assuming "parameter" doesn't fit the line):
bool f = someFunction() && someFunctionWithParam(
parameter) && someOtherFunction();
Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but
there are subsequent tokens ("&&" and "someOtherFunction") with a lower level.
This is bad for readability as "parameter" hides "someOtherFunction". With this
patch, this changes to:
bool f = someFunction() &&
someFunctionWithParam(parameter) &&
someOtherFunction();
NAKAMURA Takumi [Mon, 24 Dec 2012 01:49:04 +0000 (01:49 +0000)]
clang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTablePointer(), VTTBuilder::LayoutSecondaryVirtualPointers(), and VTTBuilder::LayoutSecondaryVirtualPointers(). [-Wdocumentation]
/// \param AddressPoints - If the vtable is a construction vtable, this has the address points for it.
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:59 +0000 (01:48 +0000)]
CGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPartialArrayCleanup() and CodeGenFunction::pushRegularPartialArrayCleanup(). [-Wdocumentation]
/// \param array - a value of type elementType*
/// \param destructionKind - the kind of destruction required
/// \param initializedElementCount - a value of type size_t* holding the number of successfully-constructed elements
Daniel Jasper [Mon, 24 Dec 2012 00:13:23 +0000 (00:13 +0000)]
Take operator precedence into account when splitting lines.
With this patch, splitting after binary operators has a panelty corresponding
to the operator's precedence. We used to ignore this and eagerly format like:
Sean Silva [Sun, 23 Dec 2012 01:19:35 +0000 (01:19 +0000)]
docs: Convert ReleaseNotes to reST.
This is the last of the "regular" documents to convert to reST, and so
I'm declaring the initial clang reST conversion "done".
However,
- There are some documents in clang/www/ which probably should
be migrated into clang/docs/, such as www/OpenProjects.html
The primary thing blocking me from doing this right now is not knowing
how to set up a redirect so that the old URL's continue to work.
- LibASTMatchersReference.html is not reST. This page is auto-generated
by clang/docs/tools/dump_ast_matchers.py from the source and has some
collapse/expand logic that isn't expressible directly with Sphinx, so
just converting it to reST is not really a good strategy.
Manuel Klimek and I discussed this and the general agreed-upon
direction is making that page data-driven so that it, say, pulls in an
auto-generated blob of JSON which describes the matchers and builds up
the "matcher reference" part of the page with a small amount of JS.
- There are some rogue .txt files hanging around.
Also, I dropped the little dragon logo at the top because Sphinx was
warning about an external image reference (not sure why, but meh, I
didn't want to fight it). If anything, we would want such a logo
integrated into the site's overall theme, rather than hardcoded here.
[libclang] Don't try to translate diagnostics from the precompiled preamble to the
code-completion results, the SourceManager state may be slightly
different when code-completing.
And we don't even care for diagnostics when code-completing, anyway.
Douglas Gregor [Fri, 21 Dec 2012 23:03:27 +0000 (23:03 +0000)]
Use a safe default width for template-diff'ing integral arguments, in
case we can't find an exact width to use. Fixes crash in
<rdar://problem/12456626>.
Ted Kremenek [Fri, 21 Dec 2012 21:59:39 +0000 (21:59 +0000)]
Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().
Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses
in boxed expressions for purpose of classification.
In other words, both @42 and @(42) should be classified as numeric
literals.
Richard Smith [Fri, 21 Dec 2012 21:52:01 +0000 (21:52 +0000)]
Switch FrontendOptions to using an initializer list rather than initializing
the values in the constructor. The constructor implementation is trivial
beyond the value initialisations. Patch by Saleem Abdulrasool!
Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in
all-std-headers.cpp.
Jordan Rose [Fri, 21 Dec 2012 18:26:48 +0000 (18:26 +0000)]
[analyzer] Don't perform an expensive assertion in release builds.
Unfortunately, we don't seem to have a standard way to do this. I'm using
the __OPTIMIZE__ GNU extension that Clang also defines, but that doesn't
help MSVC. I suppose we could remove the check entirely, but it's useful
for developing new constraint managers.
Anna Zaks [Fri, 21 Dec 2012 17:27:01 +0000 (17:27 +0000)]
[analyzer] Re-apply r170826 and make the dumping of the GallGraph
deterministic.
Commit message for r170826:
[analyzer] Traverse the Call Graph in topological order.
Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.
Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.
Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.
Richard Smith [Fri, 21 Dec 2012 08:13:35 +0000 (08:13 +0000)]
Fix regression in r170489: when instantiating a direct initializer which is a
CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an
empty pair of parentheses so that the initialization code can tell that we're
performing value-initialization.
Ted Kremenek [Fri, 21 Dec 2012 08:04:20 +0000 (08:04 +0000)]
Refactor checkUnsafeAssigns() to avoid code duplication with while loop.
This is just a minor bit of refactoring, but it is nice cleanup for
the subsequent patch that adds warning support for assigning literals
to weak variables.
Rafael Espindola [Fri, 21 Dec 2012 01:21:33 +0000 (01:21 +0000)]
Don't eagerly emit a global static merged with a local extern.
When we are visiting the extern declaration of 'i' in
static int i = 99;
int foo() {
extern int i;
return i;
}
We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.
Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.
Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.
Anna Zaks [Fri, 21 Dec 2012 01:19:22 +0000 (01:19 +0000)]
[analyzer] Traverse the Call Graph in topological order.
Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.
Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.
Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.
Anna Zaks [Fri, 21 Dec 2012 01:19:15 +0000 (01:19 +0000)]
[analyzer] Add blocks and ObjC messages to the call graph.
This paves the road for constructing a better function dependency graph.
If we analyze a function before the functions it calls and inlines,
there is more opportunity for optimization.
Note, we add call edges to the called methods that correspond to
function definitions (declarations with bodies).