Commit Graph

42880 Commits

Author SHA1 Message Date
Fariborz Jahanian 00ccbdce21 Improve on my last test for patch for // rdar://12897704
llvm-svn: 172154
2013-01-11 00:55:44 +00:00
Dmitri Gribenko a237126fc6 tg-fixits.td: fixup for Linux, which does not have a correct implementation of
llvm::sys::locale::columnWidth()

llvm-svn: 172152
2013-01-11 00:37:33 +00:00
Richard Smith 78165b53bf Truth in advertising: LocallyScopedExternalDecls actually only contains
external declarations with C language linkage.

llvm-svn: 172150
2013-01-10 23:43:47 +00:00
Anna Zaks a96a9ef716 [analyzer] Allow IvarInvalidation checker to suppress warnings via
assertions.

To ensure that custom assertions/conditional would also be supported,
just check if the ivar that needs to be invalidated or set to nil is
compared against 0.

Unfortunately, this will not work for code containing 'assert(IvarName)'

llvm-svn: 172147
2013-01-10 23:34:16 +00:00
Fariborz Jahanian cc7f008b85 c++ IRGen. In trivial cases that object is going into static
storage and thus is implicitly zero-initialized, no need to
do C++11 memory model. This patch unconditionally detects
such condition and zeroinitializer's the variable.
Patch has been commented on and OKed by Doug off-line.
// rdar://12897704

llvm-svn: 172144
2013-01-10 23:28:43 +00:00
Nico Weber 71f95e05ec Formatter: Remove a fixme, Jordy says @synthesize is good as is.
llvm-svn: 172141
2013-01-10 23:12:29 +00:00
Nico Weber 9efe291fa8 Formatter: Put spaces in ObjC method decls in the right place for Google style.
Objective-C method declarations look like this:

- (returntype)name:(type)argname anothername:(type)arg2name;

In google style, there's no space after the leading '-' but one after
"(returntype)" instead (but none after the argument types), see
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions

Not inserting the space after '-' is easy, but to insert the space after the
return type, the formatter needs to know that a closing parenthesis ends the
return type. To do this, I tweaked the code in parse() to check for this, which
in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to
parse(), because parse() runs before annotate().

(To keep things interesting, the return type is optional, but it's almost
always there in practice.)

http://llvm-reviews.chandlerc.com/D280

llvm-svn: 172140
2013-01-10 23:11:41 +00:00
Anna Zaks 640123de5e [analyzer] Fix non-determinizm introduced in r172104.
In some cases, we just pick any ivar that needs invalidation and attach
the warning to it. Picking the first from DenseMap of pointer keys was
triggering non-deterministic output.

llvm-svn: 172134
2013-01-10 22:44:16 +00:00
Will Dietz a38608b43f ToolChains: Minor touchup to use correct type, avoid truncation.
Truncation happens regularly when find_first_not_of returns npos,
strings long enough to trigger bug here are implausible.

No functionality change intended (ignoring absurd string lengths).

llvm-svn: 172127
2013-01-10 22:20:02 +00:00
Fariborz Jahanian 54c3907484 Declare +new instead of -new in test.
llvm-svn: 172126
2013-01-10 22:17:49 +00:00
Chad Rosier 97b5895029 [ms-inline asm] Add test case for r172121.
Part of rdar://12991541

llvm-svn: 172122
2013-01-10 22:11:28 +00:00
Chad Rosier 8a11f77cf3 [ms-inline asm] Extend the inline asm Sema lookup interface to determine if the
Decl is a VarDecl.
Part of rdar://12991541

llvm-svn: 172120
2013-01-10 22:10:16 +00:00
Nico Weber a2a8495e19 Formatter: No spaces around '=' in @property lines.
Before:
@property(assign, getter = isEditable) BOOL editable;

Now:
@property(assign, getter=isEditable) BOOL editable;

It'd be nice if some Apple person could let me know if spaces are preferred
around '=' in @synthesize lines (see FIXME in the test).

llvm-svn: 172110
2013-01-10 21:30:42 +00:00
Anna Zaks 0aeb60d79d [analyzer] Add more checks to the ObjC Ivar Invalidation checker.
Restructured the checker so that it could easily find two new classes of
issues:
 - when a class contains an invalidatable ivar, but no declaration of an
invalidation method
 - when a class contains an invalidatable ivar, but no definition of an
invalidation method in the @implementation.

The second case might trigger some false positives, for example, when
the method is defined in a category.

llvm-svn: 172104
2013-01-10 20:59:51 +00:00
Fariborz Jahanian 9409e46714 In my last patch use InGroup<Switch> (per Dmitri's comment).
llvm-svn: 172103
2013-01-10 20:47:57 +00:00
Fariborz Jahanian 941827931e Provide a better warning when case value overflows.
// rdar://11577384

llvm-svn: 172102
2013-01-10 20:26:42 +00:00
Nico Weber 35496eea98 Formatter: Land header change I forgot to land in r172099.
llvm-svn: 172101
2013-01-10 20:19:27 +00:00
Nico Weber d6f962f151 Formatter: Add test for template and protocol parameters in ObjC method declarations.
llvm-svn: 172100
2013-01-10 20:18:33 +00:00
Nico Weber a608775ba2 Formatting: In @implementation etc lines, put a space before protocol lists.
Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols

Most other places (function declarations, variable declarations) still get
this wrong, and since this looks very similiar to template instantiations to
the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some
places.

llvm-svn: 172099
2013-01-10 20:12:55 +00:00
Manuel Klimek 51bd6ec142 Refactoring the outermost structure of the formatter.
This is the last step of pure shuffling stuff around, the next step will
be the actual feature.

llvm-svn: 172098
2013-01-10 19:49:59 +00:00
Argyrios Kyrtzidis 1489ed2b68 [libclang] Address some coding style issues pointed out by Dmitri.
llvm-svn: 172096
2013-01-10 19:43:44 +00:00
Nico Weber a1a5abd5b1 Formatter: Don't put a space in ObjC number literals like @+50
Before:
@ -4.5

Now:
@-4.5

llvm-svn: 172095
2013-01-10 19:36:35 +00:00
Ted Kremenek 4a800f876a ccc-analyzer: Forward -msse* options to the compiler.
llvm-svn: 172094
2013-01-10 19:29:31 +00:00
Nico Weber 2bb0074232 Formatter: Add space before '(' in @implemenation, @interface, @protocol lines
The first token in @implementation, @interface, and @protocol lines is now
marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked
LT_ObjCMethodDecl.

llvm-svn: 172093
2013-01-10 19:19:14 +00:00
Manuel Klimek b2c6dbec52 Pull calculation whether a line fits one level up.
This is the next step towards being able to configure multiple unwrapped
lines into one.

llvm-svn: 172092
2013-01-10 19:17:33 +00:00
Fariborz Jahanian 1eab052a7f objectiveC++: When throwing c++ exception of
an objectiveC object, use objc_exception_throw
to raise the exception. // rdar://12605907

llvm-svn: 172091
2013-01-10 19:02:56 +00:00
Argyrios Kyrtzidis f036f1a630 [libclang] Add missing header file
llvm-svn: 172090
2013-01-10 18:58:44 +00:00
Argyrios Kyrtzidis ea47435861 [libclang] Enhance logging capabilities of libclang.
-provide a "raw_ostream'ish" class to make it convenient to output logging info.
-use macros to automate a bit the logging functionality inside libclang functions
-when logging, print a stack trace if "LIBCLANG_LOGGING=2" environment is set.
-add logging to more functions.

llvm-svn: 172089
2013-01-10 18:54:52 +00:00
Jordan Rose d12618f6db Diagnostics: name all implicit groups used more than once.
This will be a new style requirement going forwards: a diagnostic can only
use the implicit InGroup<DiagGroup<"foo">> syntax if "foo" is not used by
any other diagnostics; as soon as it is, it needs an explicit group.

This also brings some stray "conversion" diagnostics into the
"Value Conversion Issue" category, instead of the more generic
"Semantic Issue" category. I consider this an improvement!
- warn_impcast_complex_scalar
- warn_impcast_float_integer
- warn_impcast_float_precision
- warn_impcast_integer_precision
- warn_impcast_vector_scalar

llvm-svn: 172088
2013-01-10 18:50:51 +00:00
Jordan Rose c3b23aa848 Error if an anonymous DiagGroup is referenced multiple times.
Not only is this inefficient for TableGen, it's annoying for maintenance
when renaming warning flags (unusual) or adding those flags to a group
(more likely).

This uses the new fix-it infrastructure for LLVM's SourceMgr/SMDiagnostic,
as well as a few changes to TableGen to track more source information.

llvm-svn: 172087
2013-01-10 18:50:46 +00:00
Manuel Klimek 0b689fd68d Pulling formatFirstToken one level up.
This prepares the code for single line optimizations and changes the
dependencies between single-line-formats to the indent of the first
token.

Conceptually, the first token is "between" the lines anyway, as the
whitespace for the first token includes the previous end-of-line, which
needs to be escaped when inside a preprocessor directive.

llvm-svn: 172083
2013-01-10 18:45:26 +00:00
Manuel Klimek 0ddd57a17b Fixes layout of right braces.
We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.

For example, we now insert a newline before '};' in:
static SomeClass WithALoooooooooooooooooooongName = {
  100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"
};
... while not inserting a newline here:
static SomeClass = { a, b, c, d, e, f, g, h, i, j,
                     looooooooooooooooooooooooooooooooooongname,
                     looooooooooooooooooooooooooooooong };

Also fixes the formating of (column limit 25):
int x = {
  avariable,
  b(alongervariable)
};

llvm-svn: 172076
2013-01-10 15:58:26 +00:00
Alexander Kornienko 5b7157ac8d Basic support for diagnostics.
Summary: Uses DiagnosticsEngine to output diagnostics.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D278

llvm-svn: 172071
2013-01-10 15:05:09 +00:00
Manuel Klimek 73a2fdf232 Fixes formatting of function calls etc inside an initializer list.
We're now formatting (column limit 25):
int x = {
  avariable,
  b(alongervariable) };

This also fixes:
Aaa({
  int i;
}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                    ccccccccccccccccc));
... where we would previously break after the '},'.

Putting the closing curly into an extra line when there's a break
directly after the first curly will be done in a subsequent patch.

Paired with djasper.

llvm-svn: 172070
2013-01-10 14:36:46 +00:00
Manuel Klimek e7d10a1f50 Do not add newline in empty blocks.
void f() {}
now gets formatted in one line.

llvm-svn: 172067
2013-01-10 13:24:24 +00:00
Daniel Jasper c1fa281325 Improvements to function type and ObjC block formatting.
Before: int (^myBlock) (int) = ^(int num) {}
        A<void ()>;
	int (*b)(int);

After:  int (^myBlock)(int) = ^(int num) {}
        A<void()>;
	int(*b)(int);

For function types and function pointer types, this patch only makes
the behavior consistent (for types that are keywords and other types).
For the latter function pointer type declarations, we'll probably
want to add a space after "int".

Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately
Moved the LangOpts-settings to a public place for use by tests
and clang-format binary.

llvm-svn: 172065
2013-01-10 13:08:12 +00:00
Simon Atanasyan 81c423cc97 [Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
the backend if hard float ABI is selected under -mips16 mode.

llvm-svn: 172062
2013-01-10 12:36:19 +00:00
Manuel Klimek 8e07a1b64b Fix layout of blocks inside statements.
Previously, we would not indent:
SOME_MACRO({
  int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.

Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };

llvm-svn: 172058
2013-01-10 11:52:21 +00:00
Daniel Jasper 7194e1818e Improve clang-format's understanding of casts.
This fixes llvm.org/PR14684.

Before: int *pa = (int *) & a;
After:  int *pa = (int *)&a;

We still don't understand all kinds of casts. I added a FIXME to
address that.

llvm-svn: 172056
2013-01-10 11:14:08 +00:00
David Tweed c38f11de40 r172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified
version of a test by Joey Gouly to use attributes to materialise the unsupported
types and test vector shifts.

llvm-svn: 172053
2013-01-10 10:42:08 +00:00
Guy Benyei 03e61960c8 Enable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled this extension for multiple targets.
llvm-svn: 172052
2013-01-10 10:41:05 +00:00
Manuel Klimek fba4bb114b Introduce a define to switch on debug output.
After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.

llvm-svn: 172050
2013-01-10 10:05:08 +00:00
Daniel Jasper 83a54d23d3 Do more error checking for '{}'.
This fixes llvm.org/PR14883, where clang-format would run into an
assertion on:

void f() { return } 42

llvm-svn: 172049
2013-01-10 09:26:47 +00:00
David Tweed 9fb566c076 Testing with a full OpenCL compiler (based on clang) reveals r71734 missed
difference between type widths of a vector and the width of one of its elements
in the case of vector shifts. Use correct witdth in the vector case.

llvm-svn: 172047
2013-01-10 09:11:33 +00:00
NAKAMURA Takumi eacd667238 clang-c/Index.h: Clarify empty argument with (void) for C89.
llvm-svn: 172037
2013-01-10 02:12:38 +00:00
Douglas Gregor 0f2b4635be Be more careful about updating the failed-modules set
llvm-svn: 172035
2013-01-10 02:04:18 +00:00
Nick Lewycky 230203c949 Don't assert in codegen on static data members which have NoLinkage. Fixes
PR14825!

llvm-svn: 172031
2013-01-10 01:46:29 +00:00
Douglas Gregor 4ddf2221b4 Rework the realpath nonsense for framework lookups to deal more
uniformly with symlinks between top-level and embedded frameworks.

llvm-svn: 172030
2013-01-10 01:43:00 +00:00
Nico Weber bbe28b3d80 Formatter: Remove unused @-formatting code.
@optional @property is put on two different unwrapped lines now, so this is no
longer necessary.

llvm-svn: 172024
2013-01-10 00:42:07 +00:00
Nico Weber 51306d232e Formatter: @optional and @required go on their own line.
Previously:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional - (void) optional;
@required - (void) required;
@end

Now:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional
- (void)optional;
@required
- (void)required;
@end

llvm-svn: 172023
2013-01-10 00:25:19 +00:00
Nico Weber 2ce0ac5a8c Formatter: Add support for @implementation.
Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.

llvm-svn: 172019
2013-01-09 23:25:37 +00:00
Argyrios Kyrtzidis eb994f4064 [PreprocessingRecord] A macro expansion can be reported out-of-order in cases when
there are macro expansions inside macro arguments where the arguments are
not expanded in the same order as listed; don't assert that all macro expansions
are in source order.

rdar://12397063

llvm-svn: 172018
2013-01-09 23:22:20 +00:00
Argyrios Kyrtzidis 9f89bffc25 [utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the value.
Some lldb changes made lldb.frame not set until a script is invoked, which made the
formatters not working after a restart.

llvm-svn: 172017
2013-01-09 23:22:08 +00:00
Fariborz Jahanian 8b115b7872 Issue warning when case value is too large to fit
in case condition type. // rdar://11577384.
Test is conditionalized on x86_64-apple triple as
I am not sure if the INT_MAX/LONG_MAX values in the test
will pass this test for other hosts.

llvm-svn: 172016
2013-01-09 23:04:56 +00:00
Dmitri Gribenko dd7d8a0f35 ClangTools.rst: spelling and formatting
llvm-svn: 172008
2013-01-09 22:22:51 +00:00
Dmitri Gribenko cb9ede9437 ClangFormat.rst: improve formatting
llvm-svn: 172007
2013-01-09 22:18:55 +00:00
Hal Finkel 6134a6e7b8 Remove the unused Parser::ParseTranslationUnit function
Parser::ParseTranslationUnit is now dead because the loop over
ParseTopLevelDecl is in ParseAST.

llvm-svn: 172005
2013-01-09 21:49:51 +00:00
Daniel Jasper 85a77c1609 Add documentation for clang-format.
This adds documentation for both LibFormat as well as the standalone
tools and integrations built on top of it. It slightly restructures
the ClangTools documentation.

llvm-svn: 172004
2013-01-09 21:49:28 +00:00
Nico Weber d8ffe75ad1 Formatter: Make parseObjCUntilAtEnd() actually work.
llvm-svn: 172003
2013-01-09 21:42:32 +00:00
Nico Weber 8696a8d9e3 Formatting: Add support for @protocol.
Pull pieces of the @interface code into reusable methods.

llvm-svn: 172001
2013-01-09 21:15:03 +00:00
Nico Weber 4d03055e70 Fix test after r171995.
I wasn't aware libFormat is used elsewhere already. Let me know if rebasing
is not the right thing to do here.

llvm-svn: 171996
2013-01-09 20:36:10 +00:00
Nico Weber 7eecf4b6e3 Formatter: Add support for @interface.
Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.

llvm-svn: 171995
2013-01-09 20:25:35 +00:00
Benjamin Kramer 696651429d unwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.
For GCC compatibility.

llvm-svn: 171991
2013-01-09 19:54:57 +00:00
Ted Kremenek 2f2edd3fb1 Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.
Fixes false positive reported in <rdar://problem/12964481>.

llvm-svn: 171987
2013-01-09 18:46:17 +00:00
David Blaikie 5a6a020d9b Suppress GCC -Wreturn warning.
Modified from a patch by David Greene.

llvm-svn: 171982
2013-01-09 17:48:41 +00:00
Rafael Espindola 3bd836a58e Handle static functions being redeclared in function scope.
Fixes pr14861.

llvm-svn: 171978
2013-01-09 16:34:58 +00:00
Manuel Klimek 52b1515405 Enables layouting unwrapped lines around preprocessor directives.
Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
    withSomeParameters, whichInSequence,
    areLongerThanALine(andAnotherCall,
  B
                       withMoreParamters,
                       whichStronglyInfluenceTheLayout),
    andMoreParameters),
               trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

llvm-svn: 171974
2013-01-09 15:25:02 +00:00
Guy Benyei 6313f780e1 Enable intel_ocl_bicc for x86_64 target. This was missed in r171056.
llvm-svn: 171969
2013-01-09 12:21:44 +00:00
Daniel Jasper bcab430fee Only align after assignments on the top level.
This fixes llvm.org/PR14870 and we no longer mess up:
template <typename T1, typename T2 = char, typename T3 = char,
          typename T4 = char>
void f();

It removes the nice aligment for assignments inside other expressions,
but I am not sure those are actually practically relevant. If so, we can
fix those later.

llvm-svn: 171966
2013-01-09 10:40:23 +00:00
Daniel Jasper 2df93311da Don't simply give up when exceeding 80cols, choose an "ok" option.
This addresses llvm.org/PR14847.

We can now format something like:
int aaaaaaaaaaaaaaaaaaaaaaaaaaa =
    // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

clang-format unavoidably exceeds the column limit, but does not just
flush everything into a single line. Moreover, it tries to minimize the
number of characters beyond the column limit.

llvm-svn: 171964
2013-01-09 10:16:05 +00:00
Daniel Jasper 890589414b Correctly format wrapped function call parameters in templated functions.
This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

llvm-svn: 171963
2013-01-09 09:50:48 +00:00
Manuel Klimek cdd5c2397a Fixes dump_ast_matchers to parse all matcher macros and updates the
docs.

llvm-svn: 171962
2013-01-09 09:38:21 +00:00
Daniel Jasper d8bb2db242 Allow comments in the middle of statements to be on their own line.
This fixes llvm.org/PR14860.

Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
    //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
    Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}

llvm-svn: 171961
2013-01-09 09:33:39 +00:00
Daniel Jasper fb3f2482e5 Fix ObjC block declarations.
Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After:  int (^Block1) (int, int) = ^(int i, int j)
llvm-svn: 171959
2013-01-09 08:36:49 +00:00
Daniel Jasper 399d24bc7d Improve formatting of conditional operators.
This addresses llvm.org/PR14864.

We used to completely mess this up and now format as:
Diag(NewFD->getLocation(),
     getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class :
         diag::err_function_specialization_in_class)
    << NewFD->getDeclName();

llvm-svn: 171957
2013-01-09 07:06:56 +00:00
Nico Weber 69dce49c76 Don't mention -fno-diagnostics-print-source-range-info in manual.
Clang doesn't understand it.

If someone wants to teach clang about that flag instead, please also add
support for -fno-diagnostics-parseable-fixits for consistency.

Until then, let the documentation match the current behavior.

llvm-svn: 171952
2013-01-09 05:06:41 +00:00
Will Dietz 450f1a1f45 [ubsan] Make static check data non-const so it can be used for deduplication.
llvm-svn: 171947
2013-01-09 03:39:41 +00:00
Eli Friedman c52435b4a2 Make sure clang puts tokens from different files on separate lines in "-E -P" mode. <rdar://problem/12774044>
llvm-svn: 171944
2013-01-09 03:16:42 +00:00
Eli Friedman ec94b61745 Make __has_include a bit more resilient in the presence of macros. <rdar://problem/12748859>.
llvm-svn: 171939
2013-01-09 02:20:00 +00:00
Douglas Gregor 3552dabfe1 When name lookup for a redeclaration finds declarations that are known
(because they are part of some module) but have not been made visible
(because they are in a submodule that wasn't imported), filter out
those declarations unless both the old declaration and the new
declaration have external linkage. When one or both has internal
linkage, there should be no conflict unless both are imported.

llvm-svn: 171925
2013-01-09 00:47:56 +00:00
Fariborz Jahanian 14da440018 put back diagnostics when flexible members are captured
in lambdas.

llvm-svn: 171921
2013-01-09 00:09:15 +00:00
Michael Gottesman 675444d5de Removed extra "`" from ARC documentation.
llvm-svn: 171920
2013-01-08 23:55:10 +00:00
Chad Rosier d35ae732ac [ms-inline asm] Add a test case for the offset operator where the operand is a
global variable.

llvm-svn: 171919
2013-01-08 23:51:48 +00:00
Fariborz Jahanian 5eae4adf23 Fix typo (again).
llvm-svn: 171917
2013-01-08 23:48:48 +00:00
Fariborz Jahanian 7a83f04094 Remove lambda from my last patch.
llvm-svn: 171915
2013-01-08 23:40:08 +00:00
Fariborz Jahanian b68f7b2a77 Fixes typo in comment.
llvm-svn: 171913
2013-01-08 23:21:22 +00:00
Fariborz Jahanian a716a34527 objectiveC blocks: It is impractical to capture
struct variables with flexiable array members in
blocks (and lambdas). Issue error instead of
crashing in IRGen. // rdar://12655829

llvm-svn: 171912
2013-01-08 23:17:51 +00:00
Richard Smith 5f044ad5f0 PR14855: don't silently swallow a nested-name-specifier after a type name.
llvm-svn: 171908
2013-01-08 22:43:49 +00:00
Rafael Espindola b68dd4717e Clear LV cache when dropping availability attributes.
llvm-svn: 171906
2013-01-08 22:31:36 +00:00
Rafael Espindola a3aea433f8 Tighten types a bit. No functionality change.
llvm-svn: 171902
2013-01-08 22:04:34 +00:00
Rafael Espindola c231fab756 Don't crash when trying to apply the availability attribute to a block.
llvm-svn: 171899
2013-01-08 21:30:32 +00:00
Rafael Espindola c2453dd8f5 Tighten types a bit. No functionality change.
llvm-svn: 171895
2013-01-08 21:00:12 +00:00
Rafael Espindola 0a67e2fc8b Tighten types a bit. No functionality change.
llvm-svn: 171894
2013-01-08 20:44:06 +00:00
David Blaikie 9360953135 Remove on-by-default warning from -Wmost.
-Wint-to-pointer-cast, added to match GCC's warning by the same name, doesn't
need to be in any other groups (as it isn't in any groups in GCC either).

Found in post-commit review by Ted Kremenek.

llvm-svn: 171893
2013-01-08 20:28:13 +00:00
Nico Weber 4cc9874ff9 Formatter: More tests for already-passing ObjC bits.
llvm-svn: 171892
2013-01-08 20:16:23 +00:00
Anna Zaks efe76bc821 [analyzer] Bump down the max size of functions being analyzed.
With the new setting, we are not going to inline any functions that are
more than 50 basic blocks. (The analyzer is 20% faster on several
especially bad benchmarks with the new default.)

llvm-svn: 171891
2013-01-08 20:09:00 +00:00
Daniel Jasper 66dcb1ca86 Don't break after unary operators.
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *
                                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 171890
2013-01-08 20:03:18 +00:00
Rafael Espindola f26d5391ab Move loop variable update.
Thanks to Dmitri Gribenko for the suggestion.

llvm-svn: 171889
2013-01-08 19:58:34 +00:00
Rafael Espindola 820fa707b1 Mark all subsequent decls used.
In the source

  static void f();
  static void f();
  template<typename T>
  static void g() {
    f();
  }
  static void f() {
  }
  void h() {
    g<int>();
  }

the call to f refers to the second decl, but it is only marked used at the end
of the translation unit during instantiation, after the third f decl has been
linked in.

With this patch we mark all subsequent decls used, so that it is easy to check
if a symbol is used or not.

llvm-svn: 171888
2013-01-08 19:43:34 +00:00
Nico Weber 77aa25090a Formatter: Format @ literals better. Array and dictionary literals need more work.
llvm-svn: 171887
2013-01-08 19:40:21 +00:00
Jordan Rose a2d5f0c742 Various tweaks and updates to the analyzer website.
llvm-svn: 171885
2013-01-08 19:29:37 +00:00
Anna Zaks 454a384e59 [analyzer] Only include uniqueling location as issue_hash when available
This makes us more optimistic when matching reports in a changing code
base. Addresses Jordan's feedback for r171825.

llvm-svn: 171884
2013-01-08 19:19:46 +00:00
Nico Weber d8cdb53e1d Formatter: More ObjC tests.
llvm-svn: 171883
2013-01-08 19:15:23 +00:00
Argyrios Kyrtzidis bf1be59dae [libclang] In clang_equalCursors, clear out the "FirstInDeclGroup" part in a declaration cursor
before doing the comparison.

This is because we can't set "FirstInDeclGroup" consistently; for example, when visiting a DeclStmt we will set
it but we don't set it on the result of clang_getCursorDefinition for a reference of the same declaration.

llvm-svn: 171878
2013-01-08 18:23:28 +00:00
Douglas Gregor c4c1fb39d8 Use Decl::getAvailability() rather than checking for the "unavailable"
attribute when determining whether we need to see an implementation of
a property. Fixes <rdar://problem/12958191>.

llvm-svn: 171877
2013-01-08 18:16:18 +00:00
Nico Weber 7e6a7a19e3 Formatter: Add tests for some ObjC bits that happen to be formatted correctly.
llvm-svn: 171875
2013-01-08 17:56:31 +00:00
Ted Kremenek 0ab78e622f Repost checker-270, which for some reason got deleted.
llvm-svn: 171870
2013-01-08 17:33:58 +00:00
Manuel Klimek 6e67bed48c clang-format can now format #defines.
llvm-svn: 171865
2013-01-08 16:33:20 +00:00
Daniel Jasper 4f397156c4 Don't put spaces around ##.
In Clang/LLVM this seems to be the more common formatting for ##s. There
might still be case that we miss, but we'll fix those as we go along.

Before:

  #define A(X)
    void function ## X();

After:

  #define A(X)
    void function##X();

llvm-svn: 171862
2013-01-08 16:17:54 +00:00
Rafael Espindola c8c61895be Add missing spaces. This doesn't cause problems in practice because we only warn
about _Static_assert with -pedantic.

llvm-svn: 171860
2013-01-08 16:09:04 +00:00
Rafael Espindola ef5ea1df4e Clear the LV cache when setting the instantiated from link.
Fixes pr14835.

llvm-svn: 171857
2013-01-08 14:58:32 +00:00
Daniel Jasper 7c85fde500 Change the data structure used in clang-format.
This is a first step towards supporting more complex structures such
as #ifs inside unwrapped lines. This patch mostly converts the array-based
UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will
allow multiple children for each Token turning the UnwrappedLine into a
tree.

No functional changes intended.

llvm-svn: 171856
2013-01-08 14:56:18 +00:00
Dmitri Gribenko 7daa1a2201 CodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode
This hopefully fixes the ARM buildbot.

llvm-svn: 171853
2013-01-08 14:47:41 +00:00
Sean Silva 3703823b89 docs: "clang tools" are not a different interface.
I spotted someone confused about this, so remove the heading to make it
clear that they really are a part of Tooling.

llvm-svn: 171841
2013-01-08 04:42:09 +00:00
Rafael Espindola 9a5a6dddf9 Clear the LV cache when merging the availability attribute.
The availability implies default visibility, so it can change the computed
visibility.

llvm-svn: 171840
2013-01-08 04:04:30 +00:00
Eric Christopher 9cf4480392 Add a test to make sure that vector output happens for debug info.
llvm-svn: 171834
2013-01-08 01:54:13 +00:00
Ted Kremenek a046169000 Don't warn about undefined varargs argument behavior in unreachable code.
Fixes <rdar://problem/12322000>.

llvm-svn: 171831
2013-01-08 01:50:40 +00:00
David Blaikie f7e654e3a7 Add [artificial] debug info annotation to test matching r171826
llvm-svn: 171830
2013-01-08 01:12:59 +00:00
Argyrios Kyrtzidis 08281fa337 [arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
that the case does not "contain" a declaration that is referenced "outside" of it,
otherwise we will emit un-compilable code.

llvm-svn: 171828
2013-01-08 00:58:25 +00:00
Richard Smith 1ecd564487 Move ref qualifiers from Type bitfields into FunctionProtoType, stealing two
bits from the number of parameters. This brings the bitfields down from 33 bits
to 32 bits, reducing the size of Types by 4 bytes on 32-bit systems.

llvm-svn: 171827
2013-01-08 00:50:27 +00:00
Anna Zaks a043d0cef2 [analyzer] Include the bug uniqueing location in the issue_hash.
The issue here is that if we have 2 leaks reported at the same line for
which we cannot print the corresponding region info, they will get
treated as the same by issue_hash+description. We need to AUGMENT the
issue_hash with the allocation info to differentiate the two issues.

Add the "hash" (offset from the beginning of a function) representing
allocation site to solve the issue.

We might want to generalize solution in the future when we decide to
track more than just the 2 locations from the diagnostics.

llvm-svn: 171825
2013-01-08 00:25:29 +00:00
Anna Zaks 58b961d176 [analyzer] Plist: change the type of issue_hash from int to string.
This gives more flexibility to what could be stored as issue_hash.

llvm-svn: 171824
2013-01-08 00:25:22 +00:00
Anna Zaks af48a938e3 [analyzer] Extend the Representing Values section of the dev manual.
llvm-svn: 171823
2013-01-08 00:25:14 +00:00
NAKAMURA Takumi 160087b1f6 clang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.
llvm-svn: 171820
2013-01-08 00:15:53 +00:00
Richard Smith 27874d603b PR14838: When a member reference is bound to a temporary, don't forget to
perform the semantic checks associated with the destruction of that temporary.
It'll be destroyed at the end of the constructor.

llvm-svn: 171818
2013-01-08 00:08:23 +00:00
Douglas Gregor 21444b96c8 Back out my no-op change from r171783.
llvm-svn: 171817
2013-01-08 00:01:45 +00:00
Dmitri Gribenko b9eb593e50 Correct OpenBSD profiling test
The test should be looking for gcrt0.o not crt0.o.  Clang was already printing
"gcrt0", but the test was looking for "{{.*}}crt0.o", and the .* regexp
consumed "g".

Patch by Brad Smith.

llvm-svn: 171815
2013-01-07 23:55:47 +00:00
David Blaikie 7eb0685969 Extract the instance-method case for debug info out into a separate function.
This is in preparation for using this to construct the function type for
pointers to member functions to include the implicit/artificial 'this'
parameter in that case as well. (feedback from GDB indicates that this might be
all that's necessary to get it to behave well with Clang's pointer-to-member
function debug output)

llvm-svn: 171809
2013-01-07 23:06:35 +00:00
Rafael Espindola fe95841630 add a triple
llvm-svn: 171808
2013-01-07 23:04:04 +00:00
Will Dietz cefb44869a [ubsan] Use correct type for compound assignment ops.
llvm-svn: 171801
2013-01-07 22:25:52 +00:00
David Blaikie 2aaf065103 Simplify computing debug info type for static member functions.
No (intended) functional change.

llvm-svn: 171800
2013-01-07 22:24:59 +00:00
Michael Gottesman 6fd5846b57 Converted Block-ABI-Apple.txt => Block-ABI-Apple.rst.
llvm-svn: 171799
2013-01-07 22:24:45 +00:00
Sean Silva 449e4926a6 docs: Fix inconsistent titles.
Sphinx was whining about this.

llvm-svn: 171796
2013-01-07 21:46:47 +00:00
Sean Silva dc92fc3426 docs: Copy Block-ABI-Apple.txt to output.
This fixes the URL permanence of that URL. This is a bit of a hack. See
the FIXME in the patch for what the "real" solution should be.

llvm-svn: 171795
2013-01-07 21:46:35 +00:00
Fariborz Jahanian 0a17f59db8 Minor refactoring of my last patch
related to // rdar://12958878

llvm-svn: 171792
2013-01-07 21:31:08 +00:00
Daniel Dunbar 5cfa4aeee5 [docs/analyzer] Test commit (for auto-update).
llvm-svn: 171788
2013-01-07 20:44:37 +00:00
Daniel Dunbar 98a93b3845 [docs] Fix an inconsistent title level, and a sphinx warning.
- We don't need any static files currently, so drop that dir.

llvm-svn: 171787
2013-01-07 20:43:06 +00:00
Daniel Dunbar 48f8bc895b [docs/analyzer] Convert existing debug-checks document to Sphinx and link into doctree.
llvm-svn: 171786
2013-01-07 20:38:55 +00:00
Chad Rosier 8f980ef08c Test case for r171784.
llvm-svn: 171785
2013-01-07 20:34:40 +00:00
Douglas Gregor da776f9a8e Use the C++11 POD definition in C++11 mode to determine whether one
can create a VLA of class type. Fixes <rdar://problem/12151822>.

llvm-svn: 171783
2013-01-07 20:03:16 +00:00
Rafael Espindola 0370597620 Use getter. Fixes the build from a bad merge.
llvm-svn: 171782
2013-01-07 20:01:57 +00:00
Rafael Espindola f0dafd3cbb Add support for attribute((mode(unwind_word))).
Patch by Nick Lewycky. Fixes pr8703.

llvm-svn: 171781
2013-01-07 19:58:54 +00:00
Fariborz Jahanian c41cf0598f objective-C: when searching for declarations in protocol
list of classes, etc., make sure to look into protocol
definitions. // rdar://12958878

llvm-svn: 171777
2013-01-07 19:21:03 +00:00
Argyrios Kyrtzidis 68d31ce5ff [libclang] When annotating preprocessor tokens, if we are in a macro definition,
check if the token was ever a macro name and annotate it if that's the case.

llvm-svn: 171776
2013-01-07 19:16:32 +00:00
Argyrios Kyrtzidis 2d77aeb946 [libclang] Simplify annotation of preprocessing tokens and remove the AnnotateTokensData
DenseMap and the lookups associated with it.

Instead of lexing for preprocessor tokens, associating the annotation with the location in a map,
and later lookup in the map in order to adjust the cursor annotation, just annotate the cursor
while lexing for preprocessor tokens.

llvm-svn: 171775
2013-01-07 19:16:30 +00:00
Argyrios Kyrtzidis 98a8874a0d [libclang] Make token annotation of type/storage qualifiers accurate.
Previously type/storage qualifiers would not be annotated as the declaration they belonged to.
Just use the resulting source range of getRawCursorExtent() which is more correct
than what AnnotateTokensWorker::Visit() was adjusting it to.

llvm-svn: 171774
2013-01-07 19:16:27 +00:00
Argyrios Kyrtzidis 579825a50a [libclang] When getting the cursor for an identifier inside a macro definition, check if
this was ever a macro name and return a specific CXCursor_MacroExpansion cursor in such a case,
instead of the generic CXCursor_MacroDefinition.

Checking for macro name makes sure the identifier is not part of the identifier list in a
function macro.
While, in general, resolving identifiers in macro definitions to other macros may not be completely accurate,
it greatly improves functionality such as give-me-the-definition-of-this, which was not working at all
inside macro definitions.

llvm-svn: 171773
2013-01-07 19:16:25 +00:00
Argyrios Kyrtzidis 7572be2e44 [PCH] (De)serialize the end location of MacroInfo.
llvm-svn: 171772
2013-01-07 19:16:23 +00:00
Argyrios Kyrtzidis 86f1a935dc Pull the bulk of Lexer::MeasureTokenLength() out into a new function,
Lexer::getRawToken().

No functionality change.

llvm-svn: 171771
2013-01-07 19:16:18 +00:00
Anna Zaks 030e65d1b2 [analyzer] Fix a false positive in Secure Keychain API checker.
Better handle the blacklisting of known bad deallocators when symbol
escapes through a call to CFStringCreateWithBytesNoCopy.

Addresses radar://12702952.

llvm-svn: 171770
2013-01-07 19:13:00 +00:00
Anna Zaks 5f37643de1 [analyzer] Fix a false positive in the ivar invalidation checker.
When a property is "inherited" through both a parent class and directly
through a protocol, we should not require the child to invalidate it
since the backing ivar belongs to the parent class.
(Fixes radar://12913734)

llvm-svn: 171769
2013-01-07 19:12:56 +00:00
Alexander Kornienko 9569c7625a Fixed a number of -Wcovered-switch-default diagnostics in tools/clang/include/clang/AST/AttrDump.inc
llvm-svn: 171768
2013-01-07 19:09:15 +00:00
Nico Weber 04e9f1ab42 Formatter: Support @public/@protected/@package/@private.
@package is an Objective-C 2 feature, so turn on ObjC2 as well.

llvm-svn: 171766
2013-01-07 19:05:19 +00:00
Dmitri Gribenko a9cc2491dd Comment to XML conversion: no, we don't want to print instantiations for the
<Declaration> tag

llvm-svn: 171763
2013-01-07 18:45:48 +00:00
Manuel Klimek 28cacc740d Fix parsing of variable declarations directly after a class / struct.
Previous indent:
class A {
}
a;
void f() {
};

With this patch:
class A {
} a;
void f() {
}
;

The patch introduces a production for classes and structs, and parses
the rest of the line to the semicolon after the class scope.
This allowed us to remove a long-standing wart in the parser that would
just much the semicolon after any block.
Due to this suboptimal formating some tests were broken.

Some unrelated formatting tests broke; those hit a bug in the ast
printing, and need to be fixed separately.

llvm-svn: 171761
2013-01-07 18:10:23 +00:00
Alexander Kornienko 5bc364eb05 Implement Attr dumping for -ast-dump.
http://llvm-reviews.chandlerc.com/D234

Patch by Philip Craig!

llvm-svn: 171760
2013-01-07 17:53:08 +00:00
Michael Han 309af291ef Add fixit hints for misplaced C++11 attributes around class specifiers.
Following r168626, in class declaration or definition, there are a combination of syntactic locations 
where C++11 attributes could appear, and among those the only valid location permitted by standard is
between class-key and class-name. So for those attributes appear at wrong locations, fixit is used to 
move them to expected location and we recover by applying them to the class specifier.
 

llvm-svn: 171757
2013-01-07 16:57:11 +00:00
Douglas Gregor e68cf27225 updateOutOfDateIdentifier() can cause the identifier table to be
rehashed, invaliding the iterator walking through the identifier
table. Separate out the identification of out-of-date identifiers from
updating them.

llvm-svn: 171756
2013-01-07 16:56:53 +00:00
David Tweed 042e0883cb Scalar shifts in the OpenCL specification (as of v. 1.2) are defined to be
with respect to the lower "left-hand-side bitwidth" bits, even when negative);
see OpenCL spec 6.3j. This patch both implements this behaviour in the code
generator and "constant folding" bits of Sema, and also prevents tests
to detect undefinedness in terms of the weaker C99 or C++ specifications
from being applied. 

llvm-svn: 171755
2013-01-07 16:43:27 +00:00
Nico Weber d5650bdc1a Formatter: Add tests for try/catch. Let 'throw' start an expression.
Before:
  throw a *b;

Now:
  throw a * b;

llvm-svn: 171754
2013-01-07 16:36:17 +00:00
Nico Weber e89c42f409 Formatter: Don't put spaces betwen @ and objc keywords.
llvm-svn: 171753
2013-01-07 16:14:28 +00:00
Nico Weber 803d61d143 Test all @keywords. Turns out some of them are not formatted correctly yet.
llvm-svn: 171752
2013-01-07 16:07:07 +00:00
Nico Weber 12d5babba0 Slightly expand the @ test to cover whitespace between @ and keyword.
llvm-svn: 171751
2013-01-07 15:56:25 +00:00
NAKAMURA Takumi 0c340a96aa libclang/Makefile: Reorder USEDLIBS along driver/clang.
llvm-svn: 171750
2013-01-07 15:45:20 +00:00
Daniel Jasper f8673bca8d Small refactoring of the formatter code.
This should make it slightly more readable as it more clearly separates
what happens where. No intended functional changes. More of this to
come..

llvm-svn: 171748
2013-01-07 15:36:15 +00:00
Nico Weber a887650cf6 Add a test that checks that the formatter doesn't discard '@' with ObjC1 set.
Also set ObjC1 in the formatter tests.

The only effect of this flag in the lexer is that '@' now gets turned into
tok::at instead of tok::unknown.

llvm-svn: 171742
2013-01-07 15:17:23 +00:00
Nico Weber 49cbc2cb85 Fix typo.
llvm-svn: 171740
2013-01-07 15:15:29 +00:00
Manuel Klimek 6b9eeba09a s/parseStatement/parseStructuralElement/g in the UnwrappedLineParser.
llvm-svn: 171737
2013-01-07 14:56:16 +00:00
Daniel Jasper 8d1832e091 Reformat clang-formats source code.
All changes done by clang-format itself. No functional changes.

llvm-svn: 171732
2013-01-07 13:26:07 +00:00
Daniel Jasper 206df73417 Prefer not to break after assignments.
This addresses llvm.org/PR14830.

Before:
unsigned Cost =
    TTI.getMemoryOpCost(I->getOpcode(), VectorTy, SI->getAlignment(),
                        SI->getPointerAddressSpace());
CharSourceRange LineRange =
    CharSourceRange::getTokenRange(TheLine.Tokens.front().Tok.getLocation(),
                                   TheLine.Tokens.back().Tok.getLocation());

After:
unsigned Cost = TTI.getMemoryOpCost(I->getOpcode(), VectorTy,
                                    SI->getAlignment(),
                                    SI->getPointerAddressSpace());
CharSourceRange LineRange = CharSourceRange::getTokenRange(
                                TheLine.Tokens.front().Tok.getLocation(),
                                TheLine.Tokens.back().Tok.getLocation());

This required rudimentary changes to static initializer lists, but we
are not yet formatting them in a reasonable way. That will be done in a
subsequent patch.

llvm-svn: 171731
2013-01-07 13:08:40 +00:00
Daniel Jasper 5ad1e1992a Add style option for number of spaces before trailing comments.
In LLVM style, a single space should be enough. In Google style, two
spaces are required.

llvm-svn: 171725
2013-01-07 11:09:06 +00:00
Daniel Jasper da16db3f9a Do not break before "0" in pure virtual function declarations.
Before:
virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) =
    0

After:
virtual void write(ELFWriter *writerrr,
                   OwningPtr<FileOutputBuffer> &buffer) = 0;

This addresses llvm.org/PR14815.

To implement this I introduced a line type during parsing and moved the
definition of TokenType out of the struct for increased readability.
Should have done the latter in a separate patch, but it would be hard to
pull apart now.

llvm-svn: 171724
2013-01-07 10:48:50 +00:00
Manuel Klimek 7872571fc5 Fix incorrect FIXME.
The case that we wanted to write a test for cannot happen, as the
UnwrappedLineParser already protects against it. Added an assert to
prevent regressions of that assumption.

llvm-svn: 171720
2013-01-07 10:03:37 +00:00
Will Dietz df9a2bbcb1 CFG.cpp: Fix wrapping logic when printing block preds/succs.
First check only wrapped with i==8, second wrapped at i==2,8,18,28,...
This fix restores the intended behavior: i==8,18,28,...

Found with -fsanitize=integer.

llvm-svn: 171718
2013-01-07 09:51:17 +00:00
Manuel Klimek 1b89629616 Remove outdated FIXME and add explanation for error handling strategy
while parsing #define's.

llvm-svn: 171717
2013-01-07 09:34:28 +00:00
Manuel Klimek c6827ae775 Remove outdated fixme.
llvm-svn: 171716
2013-01-07 09:25:37 +00:00
Manuel Klimek 38ba11e492 Do not ever allow using the full line in preprocessor directives.
We would format:
  #define A \
    int f(a); int i;
as
  #define A \
    int f(a);\
    int i

The fix will break up macro definitions that could fit a line, but hit
the last column; fixing that is more involved, though, as it requires
looking at the following line.

llvm-svn: 171715
2013-01-07 09:24:17 +00:00
Manuel Klimek c74d292229 Fix layouting of single-line-comments preceded by an escaped newline.
Previously, we'd format
  int i;\
  // comment
as
  int i; // comment

The problem is that the escaped newline is part of the next token, and
thus the raw token text of the comment doesn't start with "//".

llvm-svn: 171713
2013-01-07 08:54:53 +00:00
Manuel Klimek ef92069940 Fix layouting of tokens with a leading escaped newline.
If a token follows directly on an escaped newline, the escaped newline
is stored with the token. Since we re-layout escaped newlines, we need
to treat them just like normal whitespace - thus, we need to increase
the whitespace-length of the token, while decreasing the token length
(otherwise the token length contains the length of the escaped newline
and we double-count it while indenting).

llvm-svn: 171706
2013-01-07 07:56:50 +00:00
Daniel Jasper c7345ccc2c Put a higher penalty on breaking before "." or "->".
This fixes llvm.org/PR14823.

Before:
    local_state->SetString(prefs::kApplicationLocale, parent_local_state
                                ->GetString(prefs::kApplicationLocale));
After:
    local_state->SetString(
        prefs::kApplicationLocale,
        parent_local_state->GetString(prefs::kApplicationLocale));

llvm-svn: 171705
2013-01-07 07:13:20 +00:00
David Blaikie 18f7c59946 PR14759: Improve/correct support for debug info for C++ member pointers.
Using added LLVM functionality in r171698. This works in GDB for member
variable pointers but not member function pointers. See the LLVM commit and
GDB bug 14998 for details.

Un-xfailing cases in the GDB 7.5 test suite will follow.

llvm-svn: 171699
2013-01-07 05:55:03 +00:00
Chandler Carruth ed0f133bc7 Switch to asking the target machine to add any relevant analysis passses
rather than doing it ourselves. This reflects the API changes in r171681.

llvm-svn: 171683
2013-01-07 01:38:01 +00:00
Nico Weber 3b435ed829 Simplify. No behavior change.
llvm-svn: 171680
2013-01-07 01:21:02 +00:00
Dmitri Gribenko 5f3c9200e5 ClangTools doc: add ideas for new tools in clang-tools-extra to ensure that
these ideas don't get lost

llvm-svn: 171667
2013-01-06 20:19:09 +00:00
Manuel Klimek 1058d987f9 Fixes handling of unbalances braces.
If we find an unexpected closing brace, we must not stop parsing, as
we'd otherwise not layout anything beyond that point.

If we find a structural error on the highest level we'll not re-indent
anyway, but we'll still want to format within unwrapped lines.

Needed to introduce a differentiation between an expected and unexpected
closing brace.

llvm-svn: 171666
2013-01-06 20:07:31 +00:00
Dmitri Gribenko 4077efc146 Clang docs: add some information about the difference between 'clang' and 'clang -cc1'
This is coming up again and again on the mailing list and IRC.

llvm-svn: 171656
2013-01-06 13:38:34 +00:00
Sylvestre Ledru bdef289eae Prepare for the upcoming version of Debian (jessie)
llvm-svn: 171655
2013-01-06 08:09:29 +00:00
Sean Silva aa73d02032 use early returns to simplify and de-nest
llvm-svn: 171654
2013-01-06 07:49:41 +00:00
Manuel Klimek 52d0fd8961 Fixes parsing of hash tokens in the middle of a line.
To parse # correctly, we need to know whether it is the first token in a
line - we can deduct this either from the whitespace or seeing that the
token is the first in the file - we already calculate this information.
This patch moves the identification of the first token into the
getNextToken method and stores it inside the FormatToken, so the
UnwrappedLineParser can stay independent of the SourceManager.

llvm-svn: 171640
2013-01-05 22:56:06 +00:00
Manuel Klimek ef2cfb110d Fixes PR14801 - preprocessor directives shouldn't be indented
Uses indent 0 for macros for now and resets the indent state to the
level prior to the preprocessor directive.

llvm-svn: 171639
2013-01-05 22:14:16 +00:00
Fariborz Jahanian feb9ae59d2 Fixes a breakage in dejagnu++ test suite where it included
<objc/Protocol.h>. Caused by my recent changes for 
various builtin declarations of objc_msgSendSuper
variety. // rdar://12489098

llvm-svn: 171638
2013-01-05 21:54:55 +00:00
David Blaikie 6e63ed0b37 Make checking for 'protected' access in debug info more legible.
Based on code review feedback for r171604 from Chandler Carruth &
Eric Christopher. Enabled by improvements to LLVM made in r171636.

llvm-svn: 171637
2013-01-05 21:41:59 +00:00
Manuel Klimek 09e0797953 Fixes PR14811: Crash when formatting some macros
A preprocessor directive cannot be started while we're parsing one.

llvm-svn: 171635
2013-01-05 21:34:55 +00:00
David Blaikie 219c7d9f64 PR14573: Unnamed parameters in debug info, Part 2
Catch some cases I'd missed in r171605 related to unnamed parameters of record
type. This resolves all remaining cases of PR14573 suppression in the GDB 7.5
test suite. Fix to the test suite to follow.

llvm-svn: 171633
2013-01-05 20:03:07 +00:00
David Blaikie a234c65613 FileCheck-ize test/CodeGen/inline.c.
A rather egregious example of the grep-style checking of old that I randomly
came across.

llvm-svn: 171631
2013-01-05 18:22:42 +00:00
Chandler Carruth ff8cd6e238 Companion patch to r171621 which changed the interface for creating TTI
passes to a create-pass function instead of a direct constructor call.

llvm-svn: 171622
2013-01-05 11:45:12 +00:00
Ted Kremenek 6a4c73db23 Fix set-xcode-analyzer to only modify the ExecPath for the analyzer when using --use-xcode-clang.
Turns out that the ExecPath for the ObjC migrator would also get set.

Fixes <rdar://problem/12961769>.

llvm-svn: 171607
2013-01-05 07:31:54 +00:00
David Blaikie a76a7c902a Emit debug info for unnamed parameters.
LLVM ignores this data for now - patch for that to follow.

llvm-svn: 171605
2013-01-05 05:58:35 +00:00
David Blaikie c905b9decd Change test/CodeGenCXX/debug-info-method.cpp an IR (rather than asm) test.
Referring back to the original commit (r115090) which was a frontend only test
I adjusted this test to verify the frontend change that was made, to emit the
protected access value in the flags metadata field.

llvm-svn: 171604
2013-01-05 05:48:08 +00:00
David Blaikie c1520bbb34 FileCheck-ize test/CodeGenCXX/debug-info-method.cpp
llvm-svn: 171602
2013-01-05 05:39:21 +00:00
Akira Hatanaka 009173f613 [mips] Fix data layout string. Add 64 to the list of native integer widths
and add stack alignment information.

llvm-svn: 171588
2013-01-05 02:04:34 +00:00
Rafael Espindola 3c98afe2ae Assert that redeclarations have the same linkage.
It is somewhat hard to test linkage, so I decided to try to add an assert. This
already found some interesting cases where there were different.

llvm-svn: 171585
2013-01-05 01:28:37 +00:00
Fariborz Jahanian cc2ae88e3c In my last patch initialize the destination to null (with a simple store) before doing a storeStrong to it.
// rdar://12530881

llvm-svn: 171572
2013-01-05 00:32:13 +00:00
Manman Ren cf15a4e97a Fix testing case for Release build (r171493)
rdar://11562117

llvm-svn: 171564
2013-01-05 00:01:42 +00:00
Ted Kremenek a49cf10737 Update checker build to checker-270
llvm-svn: 171560
2013-01-04 23:52:16 +00:00
Manuel Klimek 1abf789c7a Various fixes to clang-format's macro handling.
Some of this is still pretty rough (note the load of FIXMEs), but it is
strictly an improvement and fixes various bugs that were related to
macro processing but are also imporant in non-macro use cases.

Specific fixes:
- correctly puts espaced newlines at the end of the line
- fixes counting of white space before a token when escaped newlines are
  present
- fixes parsing of "trailing" tokens when eof() is hit
- puts macro parsing orthogonal to parsing other structure
- general support for parsing of macro definitions

Due to the fix to format trailing tokens, this change also includes a
bunch of fixes to the c-index tests.

llvm-svn: 171556
2013-01-04 23:34:14 +00:00
Fariborz Jahanian a82e9265d8 objective-C arc: in copy helper function for
__strong __block variables, perform objc_storeStrong on
source and destination instead of direct move. This 
is done with -O0 and to improve some analysis.
// rdar://12530881

llvm-svn: 171555
2013-01-04 23:32:24 +00:00
Chad Rosier ac00fbcbd2 Fix indent and remove parameter with a matching default value.
llvm-svn: 171545
2013-01-04 22:40:33 +00:00
Rafael Espindola 885106795e Style fix: We don't use lowercase-and-underscored template parameter names.
Thanks for dgregor for noticing it.

llvm-svn: 171532
2013-01-04 21:18:45 +00:00
Daniel Jasper 3c2557d0dd Correctly format dereference and address of in array parameters.
Before: InvalidRegions[ &R] = 0;
After:  InvalidRegions[&R] = 0;

This fixes llvm.org/PR14793

llvm-svn: 171522
2013-01-04 20:46:38 +00:00
Rafael Espindola 66748e93e2 Fix typo. Thanks to dgregor for noticing it.
llvm-svn: 171521
2013-01-04 20:41:40 +00:00
Rafael Espindola 4588a1a205 Unqualify the parameter type.
This fixes a regression from 168895.

llvm-svn: 171519
2013-01-04 20:34:32 +00:00
Douglas Gregor 7426050269 realpath'ify the mapping from header includes to module imports.
llvm-svn: 171516
2013-01-04 19:44:26 +00:00
Ted Kremenek 3d1464caee Update CMakeLists.txt
llvm-svn: 171505
2013-01-04 19:04:47 +00:00
Ted Kremenek dae8f9f1a2 Add __has_feature support to detect if clang supports the explicit "atomic" keyword for ObjC properties.
Fixes <rdar://problem/12953378>.

llvm-svn: 171504
2013-01-04 19:04:44 +00:00
Ted Kremenek 8533dd9f58 Require set-xcode-analyzer to run with Python 2.7 or later.
Addresses LLVM PR 11661.

llvm-svn: 171503
2013-01-04 19:04:42 +00:00
Ted Kremenek 9deaef7f44 NSErrorChecker: remove quoting the parameter name in the diagnostic until we actually include it's name.
This is a possible regression of moving to using ImplicitNullDerefEvent.
Fixing this for real (including the parameter name) requires more
plumbing in ImplicitNullDerefEvent.  This is just a stop gap fix.

llvm-svn: 171502
2013-01-04 19:04:40 +00:00
Ted Kremenek 7505b5a64c Tighten code. No functionality change.
llvm-svn: 171501
2013-01-04 19:04:36 +00:00
Douglas Gregor 8f1f3331dc Add the module name to the 'incomplete umbrella header' warning.
llvm-svn: 171497
2013-01-04 18:58:28 +00:00
Daniel Jasper c0880a904b Let the formatter ignore UnwrappedLines containing errors.
This prevents code like:

namespace {
class Foo {
  Foo(
  };
}  // comment

from causing segfaults (see llvm.org/PR14774).

llvm-svn: 171495
2013-01-04 18:52:56 +00:00
Filipe Cabecinhas c18708ee6e Add file added in r171484 to CMakelists.txt.
llvm-svn: 171494
2013-01-04 18:52:29 +00:00
Manman Ren ab08a9adab Debug Info: fix the line location for cleanup code of a block function
The line information was changed when emitting debug information for all the
DeclRefExprs and we should change it back to get ready for PopClenupBlocks
called from FinishFunction.

rdar://11562117

llvm-svn: 171493
2013-01-04 18:51:35 +00:00
Fariborz Jahanian cb6c867c46 Fix up various builtin declaration of objc_msgSend families
to match those foung in objc.h an avoid spurious warnings. 
// rdar://12489098

llvm-svn: 171492
2013-01-04 18:45:40 +00:00
Argyrios Kyrtzidis 56be71610f [libclang] Introduce clang_getFileLocation.
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.

llvm-svn: 171486
2013-01-04 18:30:13 +00:00
Argyrios Kyrtzidis d12c332905 [arcmt] Allow removing an -autorelease of a variable initialized in the previous statement.
rdar://11074996

llvm-svn: 171485
2013-01-04 18:30:11 +00:00
Argyrios Kyrtzidis 03fbe3ef81 [arcmt] Adds brackets in case statements that "contain" initialization of retaining
variable, thus emitting the "switch case is in protected scope" error.

rdar://12952016

llvm-svn: 171484
2013-01-04 18:30:08 +00:00
Argyrios Kyrtzidis aa1ce901eb Move the common source locations of CastStmt & DefaultStmt into their base class, SwitchCase.
llvm-svn: 171483
2013-01-04 18:30:04 +00:00
Argyrios Kyrtzidis b7b89b5ebc [arcmt] Don't error if an autoreleased variable is returned after the -autorelease.
rdar://12952025

llvm-svn: 171482
2013-01-04 18:29:59 +00:00
Douglas Gregor 2060482ece Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>
llvm-svn: 171478
2013-01-04 18:22:19 +00:00
Eric Christopher 0f75943780 Fix fieldNo usage for lambdas. No behavior change since the
field number was 0 anyhow.

llvm-svn: 171472
2013-01-04 17:59:07 +00:00
Rafael Espindola d2ecc139f2 Warn on unused auto variables.
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.

llvm-svn: 171458
2013-01-03 04:29:20 +00:00
Rafael Espindola 60470f1194 Use early returns to reduce indentation.
llvm-svn: 171457
2013-01-03 04:05:19 +00:00
Argyrios Kyrtzidis 6ba7afb8e1 [arcmt] Rewrite uses of Block_copy/Block_release macros.
c = Block_copy(b);
  Block_release(c);
 ---->
  c = [b copy];
  <removed>

rdar://9408211

llvm-svn: 171454
2013-01-03 03:17:17 +00:00
Ted Kremenek 1d6aac5b6a Fix capitalization of Objective-C in diagnostic.
llvm-svn: 171440
2013-01-03 01:30:20 +00:00
Ted Kremenek 6fcefb53e3 Make MallocChecker debug output useful.
llvm-svn: 171439
2013-01-03 01:30:12 +00:00
Eli Friedman 33accdf602 Don't assert/crash on reference variables in lambdas bound to a
static local variable from the parent scope.  PR14773.

llvm-svn: 171433
2013-01-03 00:39:26 +00:00
Anna Zaks 3fdcc0bda3 [analyzer] Rename callback EndPath -> EndFunction
This better reflects when callback is called and what the checkers
are relying on. (Both names meant the same pre-IPA.)

llvm-svn: 171432
2013-01-03 00:25:29 +00:00
Sean Silva ab3314f4d7 Add docs/README.txt to point to llvm/docs/README.txt.
llvm-svn: 171426
2013-01-02 23:25:41 +00:00
Sean Silva cd61d28c4a 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.

llvm-svn: 171425
2013-01-02 23:07:22 +00:00
Sean Silva 437db15978 Exclude docs/analyzer/ from the default Sphinx build.
This paves the way for converting the analyzer docs to Sphinx (by
setting up a nested Sphinx tree in this directory).

llvm-svn: 171424
2013-01-02 22:48:50 +00:00
Argyrios Kyrtzidis eedb5432c5 [python bindings] Expose cursor.referenced (clang_getCursorReferenced).
Patch by Matthew King!

llvm-svn: 171423
2013-01-02 22:31:57 +00:00
Dmitri Gribenko 1654035a3b hexagon-target-basic.c test: add REQUIRES line for hexagon target
llvm-svn: 171422
2013-01-02 22:30:14 +00:00
Argyrios Kyrtzidis f86e8cced6 DiagnosticIds: Fix offset/ID calculation, no impact outside this code.
Patch by Will Dietz:

Minor touchup so the values of Offset/ID reflect their intention.
Previously, the sum (Offset+ID) was correct, but Offset/ID
individually were wrong.

Caught by investigating unsigned overflow reported by -fsanitize=integer.

llvm-svn: 171421
2013-01-02 22:26:07 +00:00
Sean Silva b045514abf 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.

llvm-svn: 171419
2013-01-02 22:05:33 +00:00
Sean Silva aaa78eefe7 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.

llvm-svn: 171417
2013-01-02 21:50:48 +00:00
Anshuman Dasgupta 89730ce9ee Correct Hexagon DataLayout string. Fixes bug 14744.
Patch by Krzysztof Parzyszek!

llvm-svn: 171415
2013-01-02 21:25:57 +00:00
Dmitri Gribenko 154e6e53ad Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress)

llvm-svn: 171412
2013-01-02 21:12:03 +00:00
Sean Silva 13d43feb11 docs: Curb excessive table-of-contents depth.
llvm-svn: 171410
2013-01-02 21:09:58 +00:00
Sean Silva f380e0e24b 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.

Impetus from Jordan Rose.

llvm-svn: 171409
2013-01-02 21:03:11 +00:00
Sean Silva 29b7a60b12 docs: Fix spelling error.
Spotted by Nikola Smiljanic.

llvm-svn: 171407
2013-01-02 20:22:14 +00:00
Argyrios Kyrtzidis c32b022ef0 Remove the anonymous namespace from lib/Sema/TreeTransform.h
llvm-svn: 171402
2013-01-02 19:10:22 +00:00
Manuel Klimek b69e3c6201 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

llvm-svn: 171401
2013-01-02 18:33:23 +00:00
Daniel Jasper 90e51fdbab Don't allow line breaks after template parameters.
This fixes llvm.org/PR14786.

We will need to split there as a last resort, but that should be done
consistently independent of whether the type is a template type or not.

Before:
template <typename T>
aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T>
                    ::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
template <typename T>
aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 171400
2013-01-02 18:30:06 +00:00
Daniel Jasper 3c0431c887 Format */& as binary operator if followed by a unary operator.
This fixes llvm.org/PR14687.
Also fixes segfault for lines starting with * or &.

Before:
a *~b;
*a = 1;  // <- this segfaulted

After:
a * ~b;
*a = 1;  // no segfault :-)

llvm-svn: 171396
2013-01-02 17:21:36 +00:00
Manuel Klimek a71e5d8115 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.

llvm-svn: 171393
2013-01-02 16:30:12 +00:00
Daniel Jasper 542de16e50 Correctly format pointers and references in casts.
This fixes llvm.org/PR14747.

Before: Type *A = (Type * ) P;
After:  Type *A = (Type *) P;
llvm-svn: 171390
2013-01-02 15:46:59 +00:00
Daniel Jasper da1c68ab71 Understand unary operators after "return" and "case".
This fixes llvm.org/PR14746.

Before: return - 1;
After:  return -1;
llvm-svn: 171389
2013-01-02 15:26:16 +00:00
Daniel Jasper ac5c1c286c Prefer splitting after "template <...>" and fix indentation.
This addresses llvm.org/PR14699

Before:
template <typename T>
    void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T> void looooooooooooooooooooongFunction(
    int Paaaaaaaaaaaaaaaaaaaaram1, int Paaaaaaaaaaaaaaaaaaaaram2);

After:
template <typename T>
void looooooooooooooooooooooongFunction(int Param1, int Param2);
template <typename T>
void looooooooooooooooooooongFunction(int Paaaaaaaaaaaaaaaaaaaaram1,
                                      int Paaaaaaaaaaaaaaaaaaaaram2);

llvm-svn: 171388
2013-01-02 15:08:56 +00:00
Daniel Jasper 3d0c75cc96 Prefer to break after operators over breaking after "(".
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 171386
2013-01-02 14:40:02 +00:00
Sean Silva 6d2be4a24d docs: `3.2` -> `3.3`
llvm-svn: 171384
2013-01-02 13:25:05 +00:00
Sean Silva ebf3a0e465 docs: Remove useless discussion.
The linked Makefile is always up to date, so there's no point in having
a rotting list of libraries.

llvm-svn: 171383
2013-01-02 13:23:37 +00:00
Sean Silva 173d252601 docs: Fix up HTML links to proper reST links.
llvm-svn: 171382
2013-01-02 13:07:47 +00:00
Sean Silva 8966c60cae docs: clang-format is coming down the pike, mention it
llvm-svn: 171380
2013-01-02 12:49:25 +00:00
Sean Silva dd9f40641c 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.

llvm-svn: 171379
2013-01-02 12:41:24 +00:00
Sean Silva bb220f08e2 remove random spaces
llvm-svn: 171378
2013-01-02 12:40:31 +00:00
Sean Silva 2c58e5ed63 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.

llvm-svn: 171377
2013-01-02 12:40:15 +00:00
Sean Silva d2a98e6dbb docs: Decrease toctree depth on landing page.
Having the table of contents there was making it hard to easily see at a
glance all the docs we have.

llvm-svn: 171376
2013-01-02 12:39:50 +00:00
Sean Silva ff15b34dda docs: Sphinx conversion is "done"
llvm-svn: 171375
2013-01-02 12:39:02 +00:00
Richard Smith 89645bc888 s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.
llvm-svn: 171372
2013-01-02 12:01:23 +00:00
Chandler Carruth ffd5551bc7 Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
Richard Smith 2bf7fdb723 s/CPlusPlus0x/CPlusPlus11/g
llvm-svn: 171367
2013-01-02 11:42:31 +00:00
Chandler Carruth 44eb4f66f4 Re-sort #include lines using the llvm/utils/sort_includes.py script.
Removes a duplicate #include as well as cleaning up some sort order
regressions since I last ran the script over Clang.

llvm-svn: 171364
2013-01-02 10:28:36 +00:00
Daniel Jasper 22bcf8a8eb Understand * and & in ternary expressions.
Before: "int a = b ? *c : * d;"
After: "int a = b ? *c : *d;
llvm-svn: 171358
2013-01-02 08:57:10 +00:00
Daniel Jasper d1926a3758 Don't break after pointer or reference specifier.
This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
    TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                         IdentifierInfo *II, Type *T) {

Now changed to:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
                                   SourceLocation L, IdentifierInfo *II,
                                   Type *T) {

llvm-svn: 171357
2013-01-02 08:44:14 +00:00
Rafael Espindola 6525f96f01 Convert an if that never happens to an assert.
llvm-svn: 171354
2013-01-02 04:19:07 +00:00
Benjamin Kramer 7a14bc0f4c Simplify vector splat code. No functionality change.
llvm-svn: 171350
2013-01-01 20:08:10 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Rafael Espindola aadd30ec52 Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.

llvm-svn: 171329
2012-12-31 22:41:36 +00:00
Nico Weber 965368743e Fix minor copy-pasto. No functionality change.
llvm-svn: 171274
2012-12-31 02:59:14 +00:00
Nico Weber a7c7e60764 Remove some remnants of OwningExprResult / OwningStmtResult.
These got deleted late 2010 during the Actions/Sema unification.
No functionality change.

llvm-svn: 171269
2012-12-31 00:28:03 +00:00
Nico Weber a48b6c2bba Simplify. No functionality change.
llvm-svn: 171268
2012-12-30 23:36:56 +00:00
Rafael Espindola ea7537f2a2 Don't warn on unused member functions that are extern because of a typedef.
llvm-svn: 171267
2012-12-30 21:42:26 +00:00
Dmitri Gribenko 58d64e2bb1 Formatter: parse and format inline namespaces like regular namespaces
This changes formatting from:

inline namespace X {
  class A {
  };
}

to:

inline namespace X {
class A {
};
}

llvm-svn: 171266
2012-12-30 21:27:25 +00:00
Will Dietz 3676d56b71 [ubsan] Recover by default, use -fno-sanitize-recover to disable.
llvm-svn: 171264
2012-12-30 20:53:28 +00:00
Rafael Espindola a5c892058c Use hasCLanguageLinkage when warning about non C return types.
llvm-svn: 171263
2012-12-30 20:40:41 +00:00
Dmitri Gribenko 10af67a9c3 Comment lexing: replace manual comparison with StringRef::find_first_of
This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation

llvm-svn: 171262
2012-12-30 19:45:46 +00:00
Rafael Espindola 5cab029e4b Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

llvm-svn: 171260
2012-12-30 17:23:09 +00:00
Bill Wendling 5e85be4326 Remove the Function::getFnAttributes method in favor of using the AttributeSet
directly.

This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.

llvm-svn: 171254
2012-12-30 10:32:17 +00:00
Rafael Espindola 9463dce9bf 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.

llvm-svn: 171240
2012-12-29 23:43:00 +00:00
Nico Weber 9dff378a12 ArrayRefize CXXTryStmt.
llvm-svn: 171239
2012-12-29 20:13:03 +00:00
Nico Weber a2a0eb940a ArrayRefize a CompoundStmt constructor.
llvm-svn: 171238
2012-12-29 20:03:39 +00:00
Chandler Carruth 19e8beaad6 Fix a typo that caused a few standard library implementations of sort to
get the wrong answer. Wasn't caught by my implementation sadly...

llvm-svn: 171222
2012-12-29 13:00:47 +00:00
Chandler Carruth 5193dfca24 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.

None of this should really be a visible change.

llvm-svn: 171219
2012-12-29 12:01:08 +00:00
Erik Verbruggen 3f27d4e05a Removed duplicate logic.
llvm-svn: 171218
2012-12-29 11:27:03 +00:00
Rafael Espindola db7325e56e Minor cleanup.
DS parameter  has a default (null) value anyway, so there's no need for an
if/else here.
Patch by Nikola Smiljanić.

llvm-svn: 171210
2012-12-29 01:09:46 +00:00
Rafael Espindola 576127d90e 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.

llvm-svn: 171193
2012-12-28 14:21:58 +00:00
Richard Smith 9e575dafad Replace magic numbers in CheckICE with an enum.
llvm-svn: 171192
2012-12-28 13:25:52 +00:00
Richard Smith 74fc72143a PR14729: Fix typo in CheckICE for BinaryConditionalOperators.
llvm-svn: 171191
2012-12-28 12:53:55 +00:00
Richard Smith de1a487402 Improve diagnostic wording for when an implicitly-deleted special member
function is selected by overload resolution.

llvm-svn: 171190
2012-12-28 12:23:24 +00:00
Alexey Samsonov c6515b6a41 Add proper support for -fsanitize-blacklist= flag for TSan and MSan. Clang part.
llvm-svn: 171184
2012-12-28 09:31:34 +00:00
David Blaikie bf18725d11 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).

llvm-svn: 171175
2012-12-28 01:16:31 +00:00
Richard Smith d8f265a5b8 Simplify typeid 'potentially evaluated' check.
llvm-svn: 171162
2012-12-27 15:26:27 +00:00
Rafael Espindola cffa95d73f Implement dcl.link paragraph 5.
The language linkage of redeclarations must match. GCC was already reporting
an error for this.

llvm-svn: 171139
2012-12-27 03:56:20 +00:00
Eric Christopher a487035ca9 Update test for backend change.
TODO: This test should be moved to the backend.
llvm-svn: 171134
2012-12-27 02:20:24 +00:00
Rafael Espindola 1779760cb4 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.

llvm-svn: 171088
2012-12-26 04:38:44 +00:00
Rafael Espindola dfa5f9b511 Use the most recent redecl to decide if it is needed.
This fixes pr14691, which I think is a regression from r168519.

llvm-svn: 171077
2012-12-26 00:13:29 +00:00
Richard Smith 940a6d73ce 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.

llvm-svn: 171074
2012-12-25 21:56:27 +00:00
Erik Verbruggen 11a2eccc8b 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().

llvm-svn: 171067
2012-12-25 14:51:39 +00:00
Guy Benyei f0a014bbb7 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
llvm-svn: 171056
2012-12-25 08:53:55 +00:00
Rafael Espindola 54606d57a2 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.

llvm-svn: 171053
2012-12-25 07:31:49 +00:00
NAKAMURA Takumi eb63feb5bd Revert r171048, "Cache visibility of decls."
It broke stage2.

llvm-svn: 171050
2012-12-25 04:47:44 +00:00
Rafael Espindola f92a59f0cb 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.

llvm-svn: 171048
2012-12-25 00:39:58 +00:00
Nick Lewycky a5d914196c Simplify RUN lines. No functionality change.
llvm-svn: 171045
2012-12-24 21:45:14 +00:00
Daniel Jasper 8fbd96855c 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.

llvm-svn: 171039
2012-12-24 16:51:15 +00:00
Daniel Jasper 6d822720f0 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();

llvm-svn: 171038
2012-12-24 16:43:00 +00:00
Daniel Jasper 2eda23e78a Align RHS after assignments and return statements.
This changes:
  int Result = a +  // force break
      b;
  return Result +  // force break
      5;

To:
  int Result = a +  // force break
               b;
  return Result +  // force break
         5;

llvm-svn: 171032
2012-12-24 13:43:52 +00:00
Daniel Jasper 537a29638d Fix formatting over overloaded operators.
This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch changes, e.g.

  operator *() {}
  operator >() {}
  operator () () {}

to

  operator*() {}
  operator>() {}
  operator()() {}

llvm-svn: 171028
2012-12-24 10:56:04 +00:00
Evgeniy Stepanov ad8ab3d9ea Support -fsanitize-memory-track-origins.
llvm-svn: 171020
2012-12-24 08:42:34 +00:00
NAKAMURA Takumi cc80b551bf CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]
/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

llvm-svn: 171015
2012-12-24 02:03:30 +00:00
NAKAMURA Takumi 5fe61c6952 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.

llvm-svn: 171014
2012-12-24 01:49:04 +00:00
NAKAMURA Takumi 320c1f8806 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

llvm-svn: 171013
2012-12-24 01:48:59 +00:00
NAKAMURA Takumi 07c2e02e27 DiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansions(). [-Wdocumentation]
/// \param MacroSkipEnd The depth to stop skipping macro expansions.

llvm-svn: 171012
2012-12-24 01:48:53 +00:00
NAKAMURA Takumi 368d2ee4ef CGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]
llvm-svn: 171011
2012-12-24 01:48:48 +00:00
NAKAMURA Takumi 6cebf7f8c0 test/Index/preamble_macro_template.cpp: Tweak for win32.
Using the file immediately after "> file 2>&1" causes weird behavior on win32.
For example, "foo > %t 2>&1; FileCheck --input-file=%t"

Use "foo 2>&1 | tee %t" instead.

Note, mixing stdout and stderr to the same handle might cause unexpected behavior, due to buffering.

llvm-svn: 171009
2012-12-24 01:23:48 +00:00
Daniel Jasper de5c20792d 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:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb &&
      ccccccccccccccccccccccccc) { .. }

With this patch, this becomes:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa ||
      bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. }

llvm-svn: 171007
2012-12-24 00:13:23 +00:00
Dmitri Gribenko 114d895e26 Documentation: PTHInternals: use correct adornments and fix typos
Fixes PR14014

llvm-svn: 171005
2012-12-23 18:39:54 +00:00
Dmitri Gribenko 46735cb9ce Documentation: fix a syntax error: empty line required after code-block::
llvm-svn: 171004
2012-12-23 18:36:44 +00:00
Dmitri Gribenko dd20f2c3eb Documentation: add MemorySanitizer to the toctree
llvm-svn: 171003
2012-12-23 18:35:58 +00:00
Sean Silva fe25144e68 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.

llvm-svn: 170994
2012-12-23 01:19:35 +00:00
Nico Weber 6f372e6533 libFormat: Teach the *& usage heuristic that "return" starts a rhs too.
"return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;".

Fixes PR14687 partially.

llvm-svn: 170993
2012-12-23 01:07:46 +00:00
Nico Weber cb4c7f4b18 Move a declaration closer to its use. No functionality change.
llvm-svn: 170992
2012-12-23 00:40:46 +00:00
Benjamin Kramer a296431357 Clean out release notes for clang 3.3
llvm-svn: 170987
2012-12-22 16:12:31 +00:00
Argyrios Kyrtzidis 9fd1571e7a [libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.

llvm-svn: 170980
2012-12-22 04:48:10 +00:00
Argyrios Kyrtzidis 430a938fde [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.

llvm-svn: 170979
2012-12-22 04:48:08 +00:00
Argyrios Kyrtzidis 9999f4f88b [libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
a separate thread for code-completion.

llvm-svn: 170978
2012-12-22 04:48:07 +00:00
Richard Smith 21bae43fab PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.
llvm-svn: 170976
2012-12-22 02:46:14 +00:00
Ted Kremenek 6cae9ec643 Add back -Wduplicate-enum which I mistakenly removed.
This was removed with -Wunique-enum, which is still removed.  The
corresponding thread on cfe-comments for that warning is here:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html

If we get specific user feedback for -Wduplicate-enum we can evaluate
whether or not to keep it.

llvm-svn: 170974
2012-12-22 01:34:09 +00:00
Ted Kremenek c632467e2b Fix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_variable_assignment.
Fixes <rdar://problem/12927551>.

llvm-svn: 170971
2012-12-22 00:34:48 +00:00
Anna Zaks 0dffbd6b8e [analyzer] Convert SimpleStreamChecker to use the PointerEscape callback
The new callback greatly simplifies the checker.

llvm-svn: 170969
2012-12-22 00:18:39 +00:00
Douglas Gregor 2d5a5613ce 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>.

llvm-svn: 170951
2012-12-21 23:03:27 +00:00
Fariborz Jahanian 9017ec3a62 Adding to FormatTest.cpp test for a very long ObjC method
declaration requiring formatting of wrap-arounds.

llvm-svn: 170946
2012-12-21 22:51:18 +00:00
Ted Kremenek 6487335f43 Tweak Sema::CheckLiteralKind() to also include block literals
This simplifies some diagnostic logic in checkUnsafeAssignLiteral(),
hopefully making it less error prone.

llvm-svn: 170945
2012-12-21 22:46:35 +00:00
Matt Beaumont-Gay cab0f3131e Insulate this test from the whims of the random number generator.
Our internal buildbot just failed because the tempfile happened to be named
'nodefaultlib-lcGA7k.o', which contains the substring '-lc'.

llvm-svn: 170941
2012-12-21 22:43:20 +00:00
Chad Rosier 8a67a65a4b Add comments back that were accidentally removed in r170933.
llvm-svn: 170938
2012-12-21 22:38:37 +00:00
Chad Rosier 35e18ad918 Fix a warning due to an extraneous comma.
llvm-svn: 170935
2012-12-21 22:33:20 +00:00
Chad Rosier 92f0dccbad Remove unused arguments and rename to conform to coding standards.
llvm-svn: 170933
2012-12-21 22:24:43 +00:00
Ted Kremenek 44c2a2a26e 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.

llvm-svn: 170931
2012-12-21 21:59:39 +00:00
Ted Kremenek 01a33f82d2 Hoist logic for classifying Objective-C literals into Sema (proper) for use with other diagnostics.
No immediate (intended) functionality change.

llvm-svn: 170930
2012-12-21 21:59:36 +00:00
Richard Smith a90d567af6 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!

llvm-svn: 170929
2012-12-21 21:52:01 +00:00
Fariborz Jahanian 7a16a02eec 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.

llvm-svn: 170928
2012-12-21 21:43:05 +00:00