Uses of clang_getSpellingLocation should eventually move to calling
clang_getFileLocation, and clang_getSpellingLocation should do what
its name represents and actually point at the 'spelling' location, e.g.
inside a macro definition if the spelling of a token came from that.
[arcmt] Adds brackets in case statements that "contain" initialization of retaining
variable, thus emitting the "switch case is in protected scope" error.
To do so we have to wait until we know that the type of a variable has been
deduced. Sema::FinalizeDeclaration is the first callback that is used for
decl with or without initializers.
Sean Silva [Wed, 2 Jan 2013 23:07:22 +0000 (23:07 +0000)]
analyzer: add initial Sphinx configuration
This is just the output of sphinx-quickstart. Now all that is needed
to begin converting the analyzer docs to reST is the server-side setup.
The analyzer folks have asked me to keep this segregated from the other
clang docs since the analyzer is a logically separate project (and has
its own separate web page) even though it resides in the clang tree.
Sean Silva [Wed, 2 Jan 2013 22:05:33 +0000 (22:05 +0000)]
docs: Mark ReleaseNotes as "In-Progress"
Even though we do have a `.. warning::` directive on the page, hopefully
having "In-Progress" in the title will help to condition people's
expectations a bit for when they run into the extremely bare-bones
release notes.
Also, when release season comes around again, maybe this will get
people's attention and avoid confusion about what is going into the
upcoming release, and what is for changes to trunk for the next version.
Sean Silva [Wed, 2 Jan 2013 21:50:48 +0000 (21:50 +0000)]
docs: Take advantage of extra level of headings.
The way Sphinx treats the "top-level" adornments is weird. It usually
uses the first top-level adornment as the page title, even if the
top-level adornment is just one "section" out of many (i.e. if the first
section is "Introduction", then it will make the page title be
"Introduction"). This behavior can be overriden by using an explicit
`.. title::` directive to set the title.
Since the Sphinx stylesheet that Clang is currently using ('haiku')
nicely puts the document title at the top of the page in the header,
this weird default behavior was resulting in a redundant "title" in the
body content. Getting rid of this redundant level of headings
effectively "exposes" one more level of heading from the stylesheet to
which now makes the real "sections" more distinct.
Sean Silva [Wed, 2 Jan 2013 21:03:11 +0000 (21:03 +0000)]
docs: Reorganize landing page.
Language extensions are highly relevant to using clang as a compiler, so
move LanguageExtensions up into `Using Clang as a Compiler` on the
landing page.
The other documents from the now-gone `Language Extensions and Specs`
section on the landing page nicely fit hierarchically under
LanguageExtensions.rst, so put them under LanguageExtensions.rst's
toctree instead of on the landing page.
Manuel Klimek [Wed, 2 Jan 2013 18:33:23 +0000 (18:33 +0000)]
Fixes multiple formatting bugs.
Fixes:
- incorrect handling of multiple consecutive preprocessor directives
- crash when trying to right align the escpaed newline for a line that
is longer than the column limit
- using only ColumnLimit-1 columns when layouting with escaped newlines
inside preprocessor directives
Manuel Klimek [Wed, 2 Jan 2013 16:30:12 +0000 (16:30 +0000)]
Fixes use of unescaped newlines when formatting preprocessor directives.
This is the first step towards handling preprocessor directives. This
patch only fixes the most pressing issue, namely correctly escaping
newlines for tokens within a sequence of a preprocessor directive.
The next step will be to fix incorrect format decisions on #define
directives.
Sean Silva [Wed, 2 Jan 2013 12:41:24 +0000 (12:41 +0000)]
docs: Reorganize landing page.
I clustered the docs by some intuitive/fuzzy notion of "similarity", and
some reasonable categories seemed to materialize. I tried to give the
clusters useful names, but you may want to take a look at the landing
page (<http://clang.llvm.org/docs/> for the lazy) and share your
thoughts.
I have to say, this small change really gives the docs a whole new life!
It makes our documentation quite a bit easier to navigate and scope out.
Sean Silva [Wed, 2 Jan 2013 12:40:15 +0000 (12:40 +0000)]
docs: Change title.
The core of this page is a set of pros/cons for the different ways to
use clang as a library. The title should reflect that the page helps you
choose between alternatives.
Rafael Espindola [Sat, 29 Dec 2012 23:43:00 +0000 (23:43 +0000)]
Don't warn for undefined but used decls that are external because of a typedef.
This fixes pr14736. It is fairly ugly, but I don't think we can do much better
as we have to wait at least until the end of the typedef to know if the
function will have external linkage or not.
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