Commit Graph

29995 Commits

Author SHA1 Message Date
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Fariborz Jahanian 3a65ce3a56 Objective-C modern rewriter. Fixes a bug
rewriting typedef for a qualified object type
and also when two declarations happen to be on the
same line. // rdar://13562505

llvm-svn: 178680
2013-04-03 19:11:21 +00:00
Argyrios Kyrtzidis 0c2f30b9d3 [preprocessor] Allow comparing two macro definitions syntactically instead of only lexically.
Syntactically means the function macro parameter names do not need to use the same
identifiers in order for the definitions to be considered identical.

Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also
use this kind of comparison to check for ambiguous macros coming from modules.

rdar://13562254

llvm-svn: 178671
2013-04-03 17:39:30 +00:00
Nico Weber 04e213b6b6 Emit a nicer diagnostic for misplaced attributes on ObjC directives.
llvm-svn: 178670
2013-04-03 17:36:11 +00:00
Kaelyn Uhrain 989b7ca092 Give the default CorrectionCandidateCallback::ValidateCandidate some
smarts so that it doesn't approve of keywords and/or type names when it
knows (based on its flags) that those kinds of corrections are not
wanted.

llvm-svn: 178668
2013-04-03 16:59:49 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Daniel Jasper a628c98bd3 Improve formatting of for loops and multi-variable DeclStmts.
This combines several related changes:
a) Don't break before after the variable types in for loops with a
   single variable.
b) Better indent DeclStmts defining multiple variables.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaa =
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa),
     bbbbbbbbbbbbbbbbbbbbbbbbb =
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb);
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         aaaaaaaaaaa = aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa;
     aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {
}

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaa =
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa),
     bbbbbbbbbbbbbbbbbbbbbbbbb =
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb);
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa =
         aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa;
     aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {
}

llvm-svn: 178641
2013-04-03 13:36:17 +00:00
Alexander Kornienko b1be9d6e74 Even better way to handle comments adjacent to preprocessor directives.
Summary:
It turns out that we don't need to store CommentsBeforeNextToken in the
line state, but rather flush them before we start parsing preprocessor
directives. This fixes wrong comment indentation in code blocks in macro calls
(the test is included).

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 178638
2013-04-03 12:38:53 +00:00
Andy Gibbs c804e08a67 Enable use of _Static_assert inside structs and unions in C11 mode (as per C11 6.7.2.1p1).
llvm-svn: 178632
2013-04-03 09:46:04 +00:00
Andy Gibbs 22e140bee4 Assert that Parser::ParseStructUnionBody is not called for C++ code.
llvm-svn: 178631
2013-04-03 09:31:19 +00:00
Daniel Jasper 5188e6b295 Cleanup, add comments and address review comments.
No functional changes.

llvm-svn: 178626
2013-04-03 07:21:51 +00:00
Argyrios Kyrtzidis 3e612b419a [modules] If a submodule has re-definitions of the same macro, only the last definition will be used as the "exported" one.
Fixes rdar://13562262

llvm-svn: 178622
2013-04-03 05:11:33 +00:00
Douglas Gregor 05ba2a055d Use getPredefinesFileID() appropriately.
Thanks to Argyrios for the pointer.

llvm-svn: 178616
2013-04-03 03:16:36 +00:00
Richard Trieu 17f13ecc5b Refactor the Get* functions to be more consistant among themselves.
llvm-svn: 178613
2013-04-03 03:06:48 +00:00
Richard Trieu bcd06c0220 Do not assume the template argument is an integer only because the
expressions are integer.  It can also be ValueDecl expressions

Use the type information from the TemplateParameterList instead

Patch by Olivier Goffart!

llvm-svn: 178611
2013-04-03 02:31:17 +00:00
Richard Trieu ad13f55356 Fix a crasher in Template Diffing.
When support was added for declaration arguments, the case of variadic
declaration arguments was not supported.  This patch fixes that problem by
not crashing when certain ValueDecl's are null.

Patch by Olivier Goffart!

llvm-svn: 178610
2013-04-03 02:22:12 +00:00
Richard Trieu 981de5cef3 Fix a crasher in Template Diffing.
Value depenedent expressions for default arguments cannot be evaluated.
Instead, use the desugared template type to get an argument expression that
can be used.  This is needed for both integer and declaration arguements.

Also, move this common code into a separate function.

Patch by Olivier Goffart!

llvm-svn: 178609
2013-04-03 02:11:36 +00:00
Eric Christopher b7d97e95e8 From PR9121 gcc defaulted to omitting the frame pointer on linux,
however, it doesn't do that unless we're optimizing. Change
that and haul out to a helper function. Also make this a driver
test appropriate rather than an assembly test.

llvm-svn: 178606
2013-04-03 01:58:53 +00:00
Jordan Rose a0e9d39b55 Escape more @ signs in Doxygen comments.
Doxygen treats "@command" the same as "\command" in a doc comment, so
whenever we talk about Objective-C things like "@interface" we have to
make sure to escape them.

Let's try to keep Clang -Wdocumentation-clean!

llvm-svn: 178603
2013-04-03 01:39:23 +00:00
Jordan Rose bc74eb1c90 [analyzer] Better model for copying of array fields in implicit copy ctors.
- Find the correct region to represent the first array element when
  constructing a CXXConstructorCall.
- If the array is trivial, model the copy with a primitive load/store.
- Don't warn about the "uninitialized" subscript in the AST -- we don't use
  the helper variable that Sema provides.

<rdar://problem/13091608>

llvm-svn: 178602
2013-04-03 01:39:08 +00:00
John McCall 638d4f5d11 In ObjC++ on legacy runtimes, push an EH cleanup as well as
a normal cleanup when entering a @try or @synchronized to
ensure that we clean that up if an exception is triggered.

Apparently GCC did this, so it's hard to argue that we shouldn't
do at least as much.

rdar://12364847

llvm-svn: 178599
2013-04-03 00:56:07 +00:00
Fariborz Jahanian 896ae920d5 Objective-C arc [qui]. Don't issue the bridge cast
warning when doing a __bride cast in non-arc
mode (which has no retain count effect).
// rdar://13514210

llvm-svn: 178592
2013-04-02 23:48:59 +00:00
Aaron Ballman 235af9c1f5 Silencing warnings in MSVC due to duplicate identifiers.
llvm-svn: 178591
2013-04-02 23:47:53 +00:00
Eric Christopher 5c7ee8b996 Revert "Revert r178079, it caused PR15637."
This reverts commit r178497 since the backend has been fixed.

Also add a test to ensure that we're emitting template information for unions.

llvm-svn: 178587
2013-04-02 22:59:11 +00:00
Richard Smith b4d2a15d17 If a defaulted special member is implicitly deleted, check whether it's
overriding a non-deleted virtual function. The existing check for this doesn't
catch this case, because it fires before we mark the method as deleted.

llvm-svn: 178563
2013-04-02 19:38:47 +00:00
Fariborz Jahanian f12ff4df48 Objective-C: Provide fixit hints when warning
about 'isa' ivar being explicitely accessed
when base is a user class object reference.
// rdar://13503456

llvm-svn: 178562
2013-04-02 18:57:54 +00:00
Richard Smith 55a634996f Remove dead store.
llvm-svn: 178561
2013-04-02 18:57:50 +00:00
Reid Kleckner 08a39a686e [ms-cxxabi] Rename enum and remove dead case per Jordan's suggestion
The IHM_ prefix was a fairly gross abbreviation to try to hit three
characters for uniqueness.

llvm-svn: 178551
2013-04-02 17:40:19 +00:00
Reid Kleckner daa0f3176e [ms-cxxabi] Remove unused variable
llvm-svn: 178550
2013-04-02 17:24:20 +00:00
Reid Kleckner be377cd518 [ms-cxxabi] Move MS inheritance model calculation into MemberPointerType
Summary:
This makes it possible to share code between lib/AST/MicrosoftCXXABI.cpp
and lib/CodeGen/MicrosoftCXXABI.cpp.  No functionality change.

Also adds comments about the layout of the member pointer structs as I
currently understand them.

Reviewers: rjmccall

CC: timurrrr, cfe-commits

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

llvm-svn: 178548
2013-04-02 16:23:57 +00:00
Alexander Kornienko a9c809f75d Fixed "fallthrough annotation does not directly precede switch label" warning in
case when [[clang::fallthrough]]; is used in a method of a local class.

llvm-svn: 178543
2013-04-02 15:20:32 +00:00
Daniel Jasper c238c87e12 Fix some inconsistent use of indentation.
Basically we have always special-cased the top-level statement of an
unwrapped line (the one with ParenLevel == 0) and that lead to several
inconsistencies. All added tests were formatted in a strange way, for
example:

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) {
}

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) {
}

llvm-svn: 178542
2013-04-02 14:33:13 +00:00
Benjamin Kramer ae61151254 Escape # and $ in dependency files.
Fixes PR15642.

llvm-svn: 178540
2013-04-02 13:38:48 +00:00
Alexey Samsonov 262f05bab0 [ASan] Emit lifetime markers for local variables in -fsanitize=use-after-scope mode
llvm-svn: 178538
2013-04-02 13:19:46 +00:00
Alexander Kornienko b5dad75e38 Alternative handling of comments adjacent to preprocessor directives.
Summary: Store comments in ScopedLineState

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 178537
2013-04-02 13:04:06 +00:00
Anton Yartsev 01acbcebbb [analyzer] Moving cplusplus.NewDelete to alpha.* for now.
llvm-svn: 178529
2013-04-02 05:59:24 +00:00
John McCall c87d97231d Add -Wstatic-local-in-inline, which warns about using a static local
variable in a C99 inline (but not static-inline or extern-inline)
function definition.

The standard doesn't actually say that this doesn't apply to
"extern inline" definitions, but that seems like a useful extension,
and it at least doesn't have the obvious flaw that a static
mutable variable in an externally-available definition does.

rdar://13535367

llvm-svn: 178520
2013-04-02 02:48:58 +00:00
Anna Zaks 60bf5f45f7 [analyzer] Teach invalidateRegions that regions within LazyCompoundVal need to be invalidated
Refactor invalidateRegions to take SVals instead of Regions as input and teach RegionStore
about processing LazyCompoundVal as a top-level “escaping” value.

This addresses several false positives that get triggered by the NewDelete checker, but the
underlying issue is reproducible with other checkers as well (for example, MallocChecker).

llvm-svn: 178518
2013-04-02 01:28:24 +00:00
Adrian Prantl 2832b4e8cb un-break remaining gdb buildbot testcases.
Make sure we do not generate line info for debugging-related frame setup.
Follow-up to r178361 / rdar://problem/12767564

llvm-svn: 178517
2013-04-02 01:00:48 +00:00
Jordan Rose e189b869c5 [analyzer] For now, don't inline [cd]tors of C++ containers.
This is a heuristic to make up for the fact that the analyzer doesn't
model C++ containers very well. One example is modeling that
'std::distance(I, E) == 0' implies 'I == E'. In the future, it would be
nice to model this explicitly, but for now it just results in a lot of
false positives.

The actual heuristic checks if the base type has a member named 'begin' or
'iterator'. If so, we treat the constructors and destructors of that type
as opaque, rather than inlining them.

This is intended to drastically reduce the number of false positives
reported with experimental destructor support turned on. We can tweak the
heuristic in the future, but we'd rather err on the side of false negatives
for now.

<rdar://problem/13497258>

llvm-svn: 178516
2013-04-02 00:26:35 +00:00
Jordan Rose 19440f58e9 [analyzer] Cache whether a function is generally inlineable.
Certain properties of a function can determine ahead of time whether or not
the function is inlineable, such as its kind, its signature, or its
location. We can cache this value in the FunctionSummaries map to avoid
rechecking these static properties for every call.

Note that the analyzer may still decide not to inline a specific call to
a function because of the particular dynamic properties of the call along
the current path.

No intended functionality change.

llvm-svn: 178515
2013-04-02 00:26:29 +00:00
Jordan Rose 33a1063cab [analyzer] Use inline storage in the FunctionSummary DenseMap.
The summaries lasted for the lifetime of the map anyway; no reason to
include an extra allocation.

Also, use SmallBitVector instead of BitVector to track the visited basic
blocks -- most functions will have less than 64 basic blocks -- and
use bitfields for the other fields to reduce the size of the structure.

No functionality change.

llvm-svn: 178514
2013-04-02 00:26:26 +00:00
Jordan Rose d11ef1aaf7 [analyzer] Allow suppressing diagnostics reported within the 'std' namespace
This is controlled by the 'suppress-c++-stdlib' analyzer-config flag.
It is currently off by default.

This is more suppression than we'd like to do, since obviously there can
be user-caused issues within 'std', but it gives us the option to wield
a large hammer to suppress false positives the user likely can't work
around.

llvm-svn: 178513
2013-04-02 00:26:15 +00:00
Chad Rosier c3aa20265a Use the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John
and Jordan's suggestion.  No functional change intendend.

llvm-svn: 178507
2013-04-01 22:02:05 +00:00
Richard Smith 1d4b2e16a2 PR15633: Note that we are EnteringContext when parsing the nested name
specifier for an enumeration. Also fix a crash-on-invalid if a non-dependent
name specifier is used to declare an enum template.

llvm-svn: 178502
2013-04-01 21:43:41 +00:00
Argyrios Kyrtzidis d2c0abad2b [arcmt] Copy the diagnostics so we don't have to worry about invaliding iterators from the diagnostic list.
Should fix http://llvm.org/PR15500

llvm-svn: 178500
2013-04-01 21:12:30 +00:00
Tom Stellard 6674c703b6 R600: Handle -mcpu option v3
v2:
  - Add a test case

v3:
  - Use the -### clang option in the tests

llvm-svn: 178499
2013-04-01 20:56:53 +00:00
Tom Stellard 7856993228 R600: Add missing Southern Islands GPU to setCPU() function
llvm-svn: 178498
2013-04-01 20:56:49 +00:00
Nico Weber 0f27c6079b Revert r178079, it caused PR15637.
Also add a test for PR15637.

llvm-svn: 178497
2013-04-01 20:33:18 +00:00
Richard Smith 5205a8cfd8 Don't eagerly deserialize every templated function (and every static data
member inside a class template) when loading a PCH file or module.

llvm-svn: 178496
2013-04-01 20:22:16 +00:00