Commit Graph

25403 Commits

Author SHA1 Message Date
Benjamin Kramer e5fbc6c85d Lexer::ReadToEndOfLine: Only build the string if it's actually used and do so in a less malloc-intensive way.
llvm-svn: 157064
2012-05-18 19:32:16 +00:00
Rafael Espindola 3619104239 Centralize the handling of the "attribute declaration must precede definition"
warning. This also makes us warn on tags, which, ironically, is the only case
gcc warns on.

llvm-svn: 157039
2012-05-18 01:47:00 +00:00
Anna Zaks 46d01605ee [analyzer]Malloc: refactor and report use after free by memory
allocating functions.

llvm-svn: 157037
2012-05-18 01:16:10 +00:00
Douglas Gregor 0bf70f4be8 A selector match between two Objective-C methods does *not* guarantee
that the methods have the same number of parameters, although we
certainly assumed this in many places. Objective-C can be insane
sometimes. Fixes <rdar://problem/11460990>.

llvm-svn: 157025
2012-05-17 23:13:29 +00:00
Douglas Gregor c5928afb69 In the override search for Objective-C methods, protect against ASTs that have NULL interfaces behind a category, which can happen in invalid code. Fixes <rdar://problem/11478173>, a recent regression
llvm-svn: 157021
2012-05-17 22:39:14 +00:00
Argyrios Kyrtzidis 3d6439517c [arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
migration error.

This is more trouble that it is worth; autoreleasing a value without holding on it
is a valid use-case, we should not "punish" correct code for the minority of
broken/fragile programs that depend on the behavior of  -autorelease.

rdar://9914061

llvm-svn: 156999
2012-05-17 18:16:05 +00:00
Abramo Bagnara e1decdf68a Added two missing const qualifiers.
llvm-svn: 156988
2012-05-17 12:44:05 +00:00
Benjamin Kramer 1d373c6517 CXXThisScopeRAII objects aren't free, don't compute one if it's unused.
llvm-svn: 156987
2012-05-17 12:01:52 +00:00
Matt Beaumont-Gay 32d825a4db Use the argument location instead of the format string location when warning
about argument type mismatch.

This gives a nicer diagnostic in cases like
  printf(fmt,
         i);
where previously the snippet just pointed at 'fmt' (with a note at the
definition of fmt).

It's a wash for cases like
  printf("%f",
         i);
where previously we snippeted the offending portion of the format string,
but didn't indicate which argument was at fault.

llvm-svn: 156968
2012-05-17 00:03:16 +00:00
Argyrios Kyrtzidis fbb2bb5a3d [libclang/AST] When declaring a local class, don't neglect to set the end location
of the DeclStmt node, otherwise libclang will not work for anything inside that
class.

rdar://10837710

llvm-svn: 156966
2012-05-16 23:49:15 +00:00
Chad Rosier 06fd3c61be [driver] Remove obsolete support for -A link option. The standard -A option is
used by the preprocessor.  Apple's GCC also supported a -A option for linking.

The ld man page has the following:
 -A basefile - Obsolete incremental load format.  This option is obsolete.

Nick Kledzik confirms this option is no longer needed/supported.
rdar://11455614

llvm-svn: 156965
2012-05-16 23:45:12 +00:00
Richard Smith 109d5ed96d Recover better from a missing 'typename' in a function template definition.
Disambiguate past such a potential problem, and use the absence of 'typename'
to break ties in favor of a parenthesized thingy being an initializer, if
nothing else in the declaration disambiguates it as declaring a function.

llvm-svn: 156963
2012-05-16 23:40:17 +00:00
Eric Christopher de098cd08f Remove unnecessary temporary.
llvm-svn: 156953
2012-05-16 22:02:36 +00:00
Chad Rosier c14ded7182 Rename the driver option to -mno-implicit-float, per Eli's suggestion.
llvm-svn: 156950
2012-05-16 21:19:55 +00:00
Manuel Klimek 3ef9c44747 Pulls diagnostics for temp file handling into the common diagnostic kinds.
llvm-svn: 156947
2012-05-16 20:55:58 +00:00
Chad Rosier f1985d2a44 [driver] Allow the driver to directly accept the -no-implicit-float option, so that the
generation of implicit floating point instructions can be disable for ARM. 
rdar://11409142

llvm-svn: 156942
2012-05-16 20:40:09 +00:00
Chad Rosier e2d8fbbbf1 Tweek r156937 a bit so that the suggestions are correct.
llvm-svn: 156938
2012-05-16 19:42:03 +00:00
Chad Rosier 286852a10c Warn about -Wno-foo where foo is an unknown warning option. This is helpful
for subtle misspellings such as -Wno-unused-command-line-arguments instead of
-Wno-unused-command-line-argument.

Also fix the diagnostic messages to properly handle -Wno- options.  Previously,
the positive version was always emitted (i.e., -Wfoo was emitted for -Wno-foo).
rdar://11461500

llvm-svn: 156937
2012-05-16 19:28:02 +00:00
Richard Trieu 2f7dc46a58 Move the warnings for extra semi-colons under -Wextra-semi. Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.

llvm-svn: 156934
2012-05-16 19:04:59 +00:00
Douglas Gregor a8182f9b66 Clean up r156925, so that we only mark the capturing DeclRefExpr of a
lambda as referring to a local in an enclosing scope if we're in the
enclosing scope of the lambda (not it's function call operator). Also,
turn the test into an IR generation test, since that's where the
crashes occurred. Really fixes PR12746 / <rdar://problem/11465120>.

llvm-svn: 156926
2012-05-16 17:01:33 +00:00
Douglas Gregor 26b51746ec Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.

llvm-svn: 156925
2012-05-16 16:50:20 +00:00
Douglas Gregor c48eafea50 Fix ASTReader handling of ImportDecls, from Meador Inge!
llvm-svn: 156923
2012-05-16 16:31:58 +00:00
Douglas Gregor 0a9f4e0b72 Use a llvm::SmallString rather than std::string for duplicate-case errors
llvm-svn: 156922
2012-05-16 16:11:17 +00:00
Jordy Rose 31ae259a41 [analyzer] Introduce clang_analyzer_eval for regression test constraint checks.
The new debug.ExprInspection checker looks for calls to clang_analyzer_eval,
and emits a warning of TRUE, FALSE, or UNKNOWN (or UNDEFINED) based on the
constrained value of its (boolean) argument. It does not modify the analysis
state though the conditions tested can result in branches (e.g. through the
use of short-circuit operators).

llvm-svn: 156919
2012-05-16 16:01:07 +00:00
Benjamin Kramer 96a44b61c3 StringSwitchify. No functionality change.
llvm-svn: 156916
2012-05-16 12:44:25 +00:00
Benjamin Kramer f435ab429b Factor sema for attributes unavailable and deprecated into a common function.
No functionality change.

llvm-svn: 156914
2012-05-16 12:19:08 +00:00
Kostya Serebryany 66e8fab1c8 [tsan] add ThreadSanitizer linker flags on Linux and also copy the tsan-rt into the appropriate place at build time
llvm-svn: 156906
2012-05-16 06:36:00 +00:00
Douglas Gregor 9841df655e Produce more useful 'duplicate case' diagnostics. Fixes PR9243, from Terry Long!
llvm-svn: 156904
2012-05-16 05:32:58 +00:00
David Blaikie a5696dff5c Include the correct conversion context locations for condition expressions.
This improves the conversion diagnostics (by correctly pointing to the loop
construct for conversions that may've been caused by the contextual conversion
to bool caused by a condition expression) and also causes the NULL conversion
warnings to be correctly suppressed when crossing a macro boundary in such a
context. (previously, since the conversion context location was incorrect, the
suppression could not be performed)

Reported by Nico Weber as feedback to r156826.

llvm-svn: 156901
2012-05-16 04:20:04 +00:00
Rafael Espindola 96e6824c31 Fix the visibility of instantiations of static data members.
Fixes pr12835.

llvm-svn: 156897
2012-05-16 02:10:38 +00:00
Argyrios Kyrtzidis b7e4367fef [libclang/AST] Index references of protocols in "@protocol(...)" syntax.
To do that, keep track of the location of the protocol id in the ObjCProtocolExpr
AST node.

rdar://11190837

llvm-svn: 156890
2012-05-16 00:50:02 +00:00
Argyrios Kyrtzidis 8154147942 [objcmt] Accept char arrays for rewriting to @() syntax.
Part of rdar://11438360

llvm-svn: 156880
2012-05-16 00:21:21 +00:00
Argyrios Kyrtzidis cebe722ef6 [objcmt] When using NSNumber numberWithInteger:/numberWithUnsignedInteger: be
more liberal in rewriting when the parameter is an enum constant.

Part of rdar://11438360

llvm-svn: 156873
2012-05-15 22:59:54 +00:00
Fariborz Jahanian 0ebc0fa974 objective-c: perform strict type checking on property
type and its accessor type and issue error if types
are incompatible, instead of crashing in IRgen.
// rdar://1105153

llvm-svn: 156871
2012-05-15 22:37:04 +00:00
Anna Zaks 58d986c866 [analyzer] Fix a regression in ObjCUnusedIVars checker.
We can no longer rely on children iterator to visit all the AST
tree children of an expression (OpaqueValueExpr has no children).

llvm-svn: 156870
2012-05-15 22:31:56 +00:00
Argyrios Kyrtzidis 7bd957c12a [objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
to use the @() boxing syntax.

It will also rewrite uses of stringWithCString:encoding: where the encoding that is
used is NSASCIIStringEncoding or NSUTF8StringEncoding.

rdar://11438360

llvm-svn: 156868
2012-05-15 22:22:10 +00:00
David Blaikie 18e9ac7914 Don't warn when NULL is used within a macro but its conversion is outside a macro.
This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

llvm-svn: 156861
2012-05-15 21:57:38 +00:00
Richard Smith edd124ec72 Typo.
llvm-svn: 156860
2012-05-15 21:42:17 +00:00
Richard Smith fe904f0c9c If we see a declaration which is either missing a type or has a malformed type,
and the thing we have has a scope specifier, and we're in a context that doesn't
allow declaring a qualified name, then the error is a malformed type, not a
missing type.

llvm-svn: 156856
2012-05-15 21:29:55 +00:00
Richard Smith a952ebbcee Don't use the implicit int rule for error recovery in C++. Instead, try to
disambiguate whether the type name was forgotten or mistyped.

llvm-svn: 156854
2012-05-15 21:01:51 +00:00
Douglas Gregor 9295df0569 Add the Objective-C runtime linking arguments after user-specified
linker arguments. Fixes <rdar://problem/11417441>. 

llvm-svn: 156853
2012-05-15 21:00:27 +00:00
Argyrios Kyrtzidis 491e4aed31 [objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.
There are some caveats:
-If an implicit cast (e.g. int -> float for numberWithFloat:) was required, the message
 will not get rewritten
-If the message was with numberWithInteger:/numberWithUnsignedInteger:, which are very
 commonly used, be more liberal and allow the boxing syntax if the underlying type has
 same signedness and will not lose precision.

Part of rdar://11438360

llvm-svn: 156844
2012-05-15 19:17:49 +00:00
Argyrios Kyrtzidis 8e6951d81b Allow objc @() syntax for enum types.
Previously we would reject it as illegal using a value of
enum type and on ObjC++ it was illegal to use an enumerator
as well.

rdar://11454917

llvm-svn: 156843
2012-05-15 19:17:44 +00:00
Bob Wilson 16d939584b Do not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
<rdar://problem/11433499>

llvm-svn: 156841
2012-05-15 18:57:39 +00:00
Fariborz Jahanian 3da7775a6d objc: avoid duplicate diagnostics on certain type mismatches
between property and its backing ivar.

llvm-svn: 156832
2012-05-15 18:12:51 +00:00
Fariborz Jahanian e1ada58ef4 Remove word 'block' from option and diagnostic I added
in r156825.

llvm-svn: 156831
2012-05-15 17:43:16 +00:00
David Blaikie 9b88cc0a40 Changing std::string to SmallString for r156826.
Based on code review feedback by Jordan Rose.

llvm-svn: 156827
2012-05-15 17:18:27 +00:00
David Blaikie 7555b6a4e5 Improve some of the conversion warnings to fire on conversion to bool.
Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

llvm-svn: 156826
2012-05-15 16:56:36 +00:00
Fariborz Jahanian 80297b1d90 objective-c nonfragile abi: discourage ivar declarations
in @interface by issuing warning (off by default) under
opt'ed in flag -Winterface-block-ivar. // rdar://10763173

llvm-svn: 156825
2012-05-15 16:33:04 +00:00
Rafael Espindola 7f90b7d4c2 Fix our handling of visibility in explicit template instantiations.
* Don't copy the visibility attribute during instantiations. We have to be able
  to distinguish

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template DEFAULT void bar<foo>();

from

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template void bar<foo>();

* If an instantiation has an attribute, it takes precedence over an attribute
  in the template.

* With instantiation attributes handled with the above logic, we can now
  select the minimum visibility when looking at template arguments.

llvm-svn: 156821
2012-05-15 14:09:55 +00:00
Manuel Klimek fdbe4f9dc2 Fixes crasher bug in JSONCompilationDatabase for invalid input.
llvm-svn: 156814
2012-05-15 11:46:07 +00:00
Gabor Greif 9304763dfc add embedded linux variants that occur in the field
llvm-svn: 156813
2012-05-15 11:21:03 +00:00
Richard Smith d72da1513a Further improvement to wording of overload resolution diagnostics, and including
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!

llvm-svn: 156807
2012-05-15 06:21:54 +00:00
Richard Smith 8e4a3868fe PR12798: Don't drop part of the nested name specifier when instantiating a
pseudo-destructor expression. This can affect whether virtual dispatch for
the destructor call is bypassed.

llvm-svn: 156806
2012-05-15 06:15:11 +00:00
Richard Smith 9dd6e8f3ac PR12826: Converting an lvalue to an xvalue is a no-op conversion, not an lvalue-to-rvalue conversion.
llvm-svn: 156803
2012-05-15 05:04:02 +00:00
Richard Smith b9e90b13cf Fold the six functions checking explicitly-defaulted special member functions
into one. These were all performing almost identical checks, with different bugs
in each of them.

This fixes PR12806 (we weren't setting the exception specification for an
explicitly-defaulted, non-user-provided default constructor) and enforces
8.4.2/2's rule that an in-class defaulted member must exactly match the implicit
parameter type.

llvm-svn: 156802
2012-05-15 04:39:51 +00:00
John McCall 8b3f5ffb0a Change the mangling of a ref-qualifier on a function type so that
it is placed in a position which is never ambiguous with a
reference-to-function type.  This follows some recent discussion
and ensuing proposal on cxx-abi-dev.  It is not necessary to
change the mangling of CV-qualifiers because you cannot
apply CV-qualification in the normal sense to a function type.
It is not necessary to change the mangling of ref-qualifiers on
method declarations because they appear in an unambiguous
location.

In addition, mangle CV-qualifiers and ref-qualifiers on function
types when they occur in positions other than member pointers
(that is, when they appear as template arguments).

This is a minor ABI break with previous releases of clang.  It
is not considered critical because (1) ref-qualifiers are
relatively rare, since AFAIK we're the only implementing compiler,
and (2) they're particularly likely to come up in contexts that
do not rely on the ODR for correctness.  We apologize for any
inconvenience;  this is the right thing to do.

llvm-svn: 156794
2012-05-15 02:01:59 +00:00
Argyrios Kyrtzidis 0bbe94f737 [objcmt] When rewriting to subscripting syntax, make sure we put
the receiver in parentheses when necessary.

Part of rdar://11438360

llvm-svn: 156789
2012-05-14 23:33:49 +00:00
Fariborz Jahanian 16d71bb834 objc: allow typedef'ing an id to a pointer to a c-struct only.
// rdar://11356439

llvm-svn: 156788
2012-05-14 22:48:56 +00:00
Richard Smith b71e73243b Recover properly from a redundant 'typename' before a non-nested name. This is
permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor
tweaking by me.)

llvm-svn: 156786
2012-05-14 22:43:34 +00:00
Argyrios Kyrtzidis c1dfed6572 [objcmt] When rewriting to array/dictionary literals, add an explicit
cast to 'id' for any argument that requires it.

Part of rdar://11438360.

llvm-svn: 156782
2012-05-14 22:01:53 +00:00
Richard Smith bb653bd5f9 Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and the
expression is treated as an lvalue.

llvm-svn: 156781
2012-05-14 21:57:21 +00:00
Chandler Carruth 94a3201179 Teach the driver on Linux to respect -nodefaultlibs.
Patch from Andrew C. Morrow.

llvm-svn: 156771
2012-05-14 18:31:18 +00:00
Jordy Rose 459d5f62c2 [analyzer] strncpy: Special-case a length of 0 to avoid an incorrect warning.
We check the address of the last element accessed, but with 0 calculating that
address results in element -1. This patch bails out early (and avoids a bunch
of other work at that).

Fixes PR12807.

llvm-svn: 156769
2012-05-14 17:58:35 +00:00
Rafael Espindola e200f1cb75 Refactor all the
if (Inherited)
    Attr->setInherited(true);

To a central location.

llvm-svn: 156728
2012-05-13 03:25:18 +00:00
Rafael Espindola 9869c3a10f Produce a warning for mismatched section attributes. Completest pr9356.
llvm-svn: 156727
2012-05-13 02:42:42 +00:00
Benjamin Kramer 29c2b4330c Add support for __attribute__((hot)) and __attribute__((cold)).
Currently cold functions are marked with the "optsize" attribute in CodeGen
so they are always optimized for size.  The hot attribute is just ignored,
LLVM doesn't have a way to express hotness at the moment.

llvm-svn: 156723
2012-05-12 21:10:52 +00:00
Jordy Rose 4af4487ba4 Only check NSArray/NSDictionary boxing method params once.
Once we've found a "good" method, we don't need to check its argument types
again. (Even if we might have later found a "bad" method, we were already
caching the method we first looked up.)

llvm-svn: 156719
2012-05-12 17:32:56 +00:00
Jordy Rose aca01f9c93 80-col violations and minor reformatting. No functionality change.
llvm-svn: 156718
2012-05-12 17:32:52 +00:00
Jordy Rose 08e500c999 Clean up ObjC boxing method checks by reducing duplicated code.
llvm-svn: 156717
2012-05-12 17:32:44 +00:00
Rafael Espindola f1bfae5406 Remove unused variable. Thanks to Dmitri Gribenko for noticing it.
llvm-svn: 156715
2012-05-12 16:35:00 +00:00
Jordy Rose 890f4577b1 Don't crash on boxed strings when +stringWithUTF8String: is missing.
Also, unify some diagnostics for boxed expressions that have the same form.

Fixes PR12804.

llvm-svn: 156713
2012-05-12 15:53:41 +00:00
Jordy Rose 6393f82b5b [analyzer] RetainCountChecker: track ObjC boxed expression objects.
llvm-svn: 156699
2012-05-12 05:10:43 +00:00
Douglas Gregor 87a170c1e6 Teach the parser to deal with multiple spellings for the same
attribute, rather than requiring multiple cases in consumers of this
information.

llvm-svn: 156666
2012-05-11 23:37:49 +00:00
Anna Zaks e7e7c9ebf9 [analyzer] Do not walk the types for call graph construction.
llvm-svn: 156661
2012-05-11 23:15:18 +00:00
Douglas Gregor 4f362c7960 Make sure that we recognize __attribute__((align)) as a synonym for
__attribute__((aligned)). Fixes <rdar://problem/11435441>, a
regression I introduced in r156003. This is the narrow fix; a more
comprehensive fix is coming.

llvm-svn: 156657
2012-05-11 23:01:43 +00:00
Richard Smith 7d847b1ec1 When diagnosing inaccessible temporary destructors in decltype expressions, use
the correct type and the correct source location in the diagnostic. Spotted by
Johannes Schaub!

llvm-svn: 156654
2012-05-11 22:20:10 +00:00
Matt Beaumont-Gay d873508975 Merge branch 'format-string-braced-init'
llvm-svn: 156653
2012-05-11 22:10:59 +00:00
Akira Hatanaka 8ab86cb344 Coerce byval aggregate arguments to integers whose size matches the integer
register size of the target architecture.
 

llvm-svn: 156650
2012-05-11 21:56:58 +00:00
Argyrios Kyrtzidis 45f5118248 The Lexer constructor expects a source location at the start of the
file buffer, not at the start of lexing.

Fixes assertion hit in format diagnostics. rdar://11418366

llvm-svn: 156647
2012-05-11 21:39:18 +00:00
Akira Hatanaka c37eddf7a7 Fix handling of vector return types.
A vector should be returned via the hidden pointer argument except if its size
is equal to or smaller than 16-bytes and the target ABI is N32 or N64.

llvm-svn: 156642
2012-05-11 21:01:17 +00:00
Sirish Pande 84dce5d0c2 Hexagon V5 intrinsics support in clang.
llvm-svn: 156630
2012-05-11 19:39:08 +00:00
Richard Smith 10ff50d7d8 PR11857: When the wrong number of arguments are provided for a function
which expects exactly one argument, include the name of the argument in
the diagnostic text. Patch by Terry Long!

llvm-svn: 156607
2012-05-11 05:16:41 +00:00
Rafael Espindola 92d49459ab Fix a recent regression with the merging of format attributes.
llvm-svn: 156597
2012-05-11 00:36:07 +00:00
Eric Christopher f6a6346d67 For final output files create them with mode 0664 to match other
compilers and expected defaults.

Part of rdar://11325849

llvm-svn: 156592
2012-05-11 00:10:07 +00:00
Argyrios Kyrtzidis 6062da47b8 [objc] When boxing a BOOL/NSInteger/NSUInteger type, use the corresponding
numberWithBool:/numberWithInteger:/numberWithUnsignedInteger: NSNumber selectors.

rdar://11428703

llvm-svn: 156583
2012-05-10 23:12:03 +00:00
Ted Kremenek 2342067c6e Include line that was meant to be in my last commit.
llvm-svn: 156582
2012-05-10 22:49:10 +00:00
Ted Kremenek 77cbb8481b Fix insidious RegionStore bug where we (a) didn't handle vector types and (b) had
a horrible bug in GetLazyBindings where we falsely appended a field suffix when traversing 3 or more
layers of lazy bindings.  I don't have a reduced test case yet; but I have added the original source
to an internal regression test suite.  I'll see about coming up with a reduced test case.

Fixes <rdar://problem/11405978> (for real).

llvm-svn: 156580
2012-05-10 22:02:39 +00:00
Anna Zaks fe1ccee0f5 [analyzer] Exit early if constraint solver is given a non-integer symbol
to reason about.

As part of taint propagation, we now allow creation of non-integer
symbolic expressions like a cast from int to float.

Addresses PR12511 (radar://11215362).

llvm-svn: 156578
2012-05-10 21:49:52 +00:00
Sirish Pande 11ebc4ed1b Hexagon V5 FP support.
llvm-svn: 156567
2012-05-10 20:19:54 +00:00
Argyrios Kyrtzidis 9b4fe35689 Don't crash when using objc boxed expression with parsing error.
rdar://11426994

llvm-svn: 156565
2012-05-10 20:02:36 +00:00
Argyrios Kyrtzidis 9dd40890e3 When AST-dumping the ObjCBoxedExpr node, also print out what selector it chose.
llvm-svn: 156564
2012-05-10 20:02:31 +00:00
Argyrios Kyrtzidis 671ce47d60 [preprocessor] Make sure that MacroExpands callbacks are always in source order.
Fixes assertion hit in the preprocessing record. rdar://11426523

llvm-svn: 156557
2012-05-10 18:57:19 +00:00
Argyrios Kyrtzidis b16ff5d1ce Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

llvm-svn: 156536
2012-05-10 05:03:45 +00:00
Rafael Espindola a6b3cd493c Warn about visibility attributes in typedefs.
llvm-svn: 156534
2012-05-10 03:01:34 +00:00
Rafael Espindola c67f223c9e Fix an old (2009) FIXME:
// FIXME: This needs to happen before we merge declarations. Then,
// let attribute merging cope with attribute conflicts.

This was already being done for variables, but for functions we were merging
then first and then applying the attributes. To avoid duplicating merging
logic, some of the helpers in SemaDeclAttr.cpp become methods that can
handle merging two attributes in one decl or inheriting attributes from one
decl to another.

With this change we are now able to produce errors for variables with
incompatible visibility attributes or warn about unused dllimports in
variables.

This changes the attribute list iteration back to being in reverse source
code order, as that matches what decl merging does and avoids differentiating
the two cases is the merge*Attr methods.

llvm-svn: 156531
2012-05-10 02:50:16 +00:00
Anna Zaks 62cce9e47d [analyzer] Do not highlight the range of the statement in case of leak.
We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not relevant to the
leak diagnostic and, thus, should not be highlighted.

radar://11178519

llvm-svn: 156530
2012-05-10 01:37:40 +00:00
Fariborz Jahanian 7a055366f2 objective-c. Fixes a 'fixit' where location of
'*' on objective-c class name was misplaced.
// rdar://11311333

llvm-svn: 156517
2012-05-09 21:49:29 +00:00
Richard Trieu 43a2fc7b9e Pull some cases of initialization with self-reference warnings out of
-Wconditional-uninitialized into -Wuninitialized.

llvm-svn: 156512
2012-05-09 21:08:22 +00:00
Richard Smith 2f07ad5a70 Push the knowledge that we are parsing a type-id/type-name further into the
parser, and use it to emit better diagnostics in cases where an identifer
can't be looked up as a type name.

llvm-svn: 156508
2012-05-09 20:55:26 +00:00