Commit Graph

44036 Commits

Author SHA1 Message Date
Chad Rosier 09d607ecf1 [driver] If we're just linking, don't report --param X as unused option.
PR15327
rdar://13372628

llvm-svn: 176670
2013-03-08 00:05:21 +00:00
Fariborz Jahanian a649eee9e8 HeaderDoc: Support more of HeaderDoc documentation
commands; top level tags such as @interface and
their 2nd level tags such as @coclass, etc.
// rdar://12379114

llvm-svn: 176667
2013-03-07 23:33:11 +00:00
Douglas Gregor 61e368182d Add code completion for @import <rdar://problem/13344306>.
llvm-svn: 176666
2013-03-07 23:26:24 +00:00
Douglas Gregor b5af2e9c5a Improve LLDB's implicit cast-to-id to work with C++11 auto and any Objective-C object type <rdar://problem/13338107>.
llvm-svn: 176665
2013-03-07 22:57:58 +00:00
Douglas Gregor ca00645e4c When possible, move __block variables to the heap rather than copying them.
Fixes <rdar://problem/13330126>.

llvm-svn: 176663
2013-03-07 22:38:24 +00:00
John McCall a8ec7eb9cf Promote atomic type sizes up to a power of two, capped by
MaxAtomicPromoteWidth.  Fix a ton of terrible bugs with
_Atomic types and (non-intrinsic-mediated) loads and stores
thereto.

llvm-svn: 176658
2013-03-07 21:37:17 +00:00
John McCall fc207f2d70 Move the atomics code into its own file.
llvm-svn: 176657
2013-03-07 21:37:12 +00:00
John McCall 47fb950871 Change hasAggregateLLVMType, which conflates complex and
aggregate types in a profoundly wrong way that has to be
worked around in every call site, to getEvaluationKind,
which classifies and distinguishes between all of these
cases.

Also, normalize the API for loading and storing complexes.

I'm working on a larger patch and wanted to pull these
changes out, but it would have be annoying to detangle
them from each other.

llvm-svn: 176656
2013-03-07 21:37:08 +00:00
John McCall b1b5d0b1e8 Add CharUnits::alignmentAtOffset.
llvm-svn: 176655
2013-03-07 21:37:02 +00:00
John McCall bea4c3d8c4 Evaluate compound literals directly into the result aggregate
when that aggregate isn't potentially aliased.

llvm-svn: 176654
2013-03-07 21:36:54 +00:00
Benjamin Kramer 95e1936477 Remove temporary std::vectors that ca be replaced with ArrayRef's magic.
llvm-svn: 176653
2013-03-07 21:18:31 +00:00
Daniel Jasper f71cf3bd3e Remove unncessary whitespace when triggered on empty line.
With the cursor located at "I", clang-format would not do anything to:

int a;

   I

  int b;

With this patch, it reduces the number of empty lines as necessary, and
removes unnecessary whitespace. It does not change/reformat "int a;" or
"int b;".

llvm-svn: 176650
2013-03-07 20:50:00 +00:00
Edwin Vane 2a760d02f7 Adding lvalue and rvalue reference type matchers
Updated docs and tests.
    
Reviewers: klimek, gribozavr

llvm-svn: 176630
2013-03-07 15:44:40 +00:00
Guy Benyei 5ea30273a1 Add 'e' to the SPIR data layout - SPIR is little endian for now.
Add 32/64 bit specific target defines for SPIR.

llvm-svn: 176629
2013-03-07 13:06:10 +00:00
Matthew Curtis 7ab8b2b2e0 Minor refactor of how we get compilation phases.
There is now a single function to get the list of phases for a given
output Type.

No functionality change intended.

llvm-svn: 176628
2013-03-07 12:32:26 +00:00
Nick Lewycky 9164513e4f Fix build with clang, this was supposed to be part of r176617.
llvm-svn: 176619
2013-03-07 08:42:27 +00:00
Nick Lewycky 737a452173 Add flags for additional control over coverage generation. Pick the version
string to be emitted, and two properties about the files themselves.

Use $PWD to absolut-ify the path to the coverage file. Yes, this is what GCC
does. Reverts my own r175706.

llvm-svn: 176617
2013-03-07 08:28:53 +00:00
Anna Zaks 9e0da9e070 [analyzer] Warn on passing a reference to null pointer as an argument in a call
Warn about null pointer dereference earlier when a reference to a null pointer is
passed in a call. The idea is that even though the standard might allow this, reporting
the issue earlier is better for diagnostics (the error is reported closer to the place where
the pointer was set to NULL). This also simplifies analyzer’s diagnostic logic, which has
to track “where the null came from”. As a consequence, some of our null pointer
warning suppression mechanisms started triggering more often.

TODO: Change the name of the file and class to reflect the new check.
llvm-svn: 176612
2013-03-07 03:02:36 +00:00
Rafael Espindola 2199c126f5 Don't duplicate function names. Thanks to Jordan Rose for pointing it out.
llvm-svn: 176609
2013-03-07 02:43:24 +00:00
Rafael Espindola 45b620aab5 Add a hasExternalLinkage helper. No functionality change.
llvm-svn: 176607
2013-03-07 02:00:27 +00:00
Rafael Espindola 8f326a5a39 Add a hasExternalStorageAsWritten helper. No functionality change.
It is possible that some of the current uses of
"getStorageClassAsWritten() == SC_Extern" should use this but I don't know
enough about SC_PrivateExtern to change and test them.

llvm-svn: 176606
2013-03-07 01:42:44 +00:00
Rafael Espindola ee86f00f6e Fix typo.
llvm-svn: 176603
2013-03-07 01:34:57 +00:00
Jordan Rose b41977f852 [analyzer] Check for returning null references in ReturnUndefChecker.
Officially in the C++ standard, a null reference cannot exist. However,
it's still very easy to create one:

int &getNullRef() {
  int *p = 0;
  return *p;
}

We already check that binds to reference regions don't create null references.
This patch checks that we don't create null references by returning, either.

<rdar://problem/13364378>

llvm-svn: 176601
2013-03-07 01:23:25 +00:00
Jordan Rose 6f09928d5b [analyzer] Clean up a few doc comments for ProgramState and CallEvent.
No functionality change.

llvm-svn: 176600
2013-03-07 01:23:14 +00:00
Adrian Prantl a03a85a425 Ensure that DIType is regenerated after we visit an implementation
that adds ivars to an interface.

Fixes rdar://13175234

This is an update to r176116 that performs a smart caching of interfaces.

llvm-svn: 176584
2013-03-06 22:03:30 +00:00
Anna Zaks 23c85ed52b [analyzer] Pass the correct Expr to the bug reporter visitors when dealing with CompoundLiteralExpr
This allows us to trigger the IDC visitor in the added test case.

llvm-svn: 176577
2013-03-06 20:26:02 +00:00
Anna Zaks 6fe2fc633a [analyzer] IDC: Add config option; perform the idc check on first “null node” rather than last “non-null”.
The second modification does not lead to any visible result, but, theoretically, is what we should
have been looking at to begin with since we are checking if the node was assumed to be null in
an inlined function.

llvm-svn: 176576
2013-03-06 20:25:59 +00:00
Argyrios Kyrtzidis 7d23857a07 [PCH] When pre-validating the headers from the PCH, only validate non-system headers.
Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time.
In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time
12% was just stat calls. Change pre-validation to only check non-system headers.

There are some notable disadvantages:

-If a system header, that is not include-guarded, changes after the PCH was created, we will not
find it in the header info table and we will #import it, effectively #importing it twice, thus
we will emit some error due to a multiple definition and after that the "header was modified" error will likely
be emitted, for example something like:

NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary'
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
NSDictionary.h:12:12: note: previous definition is here
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
           ^
fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built

Though we get the "header was modified" error, this is a bit confusing.

-Theoretically it is possible that such a system header will cause no errors but it will just cause an
unfortunate semantic change, though I find this rather unlikely.

The advantages:

-Reduces compilation time when using a huge PCH like the Cocoa ones
-System headers change very infrequent and when they do, users/build systems should be able to know that
re-building from scratch is needed.

Addresses rdar://13056262

llvm-svn: 176567
2013-03-06 18:12:50 +00:00
Argyrios Kyrtzidis 5c2a345e48 [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.
Previously the hash would be the filename portion of the path, which could be
different for a filename with different case or a symbolic link with a different
name completely.
This did not actually create any issue so far because by validating all headers
in the PCH we created uniqued FileEntries based on inodes, so an #include of
a symbolic link (refering to a file from the PCH) would end up with a FileEntry
with filename same as the one recorded in the PCH.

llvm-svn: 176566
2013-03-06 18:12:47 +00:00
Argyrios Kyrtzidis 61a3896d9f [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once.
We can just re-use the one from HeaderFileInfoLookupTable.

llvm-svn: 176565
2013-03-06 18:12:44 +00:00
Argyrios Kyrtzidis b42863e258 [PCH] Remove a couple of fields from serialization::reader::HeaderFileInfoTrait that are not used for anything.
llvm-svn: 176564
2013-03-06 18:12:41 +00:00
Fariborz Jahanian ff81b824a2 Spell Objective-C correctly.
llvm-svn: 176563
2013-03-06 17:55:30 +00:00
Fariborz Jahanian 41bb7131b3 say objective-C in the warning and streamline
several diagnostics into one. // rdar://13094352

llvm-svn: 176560
2013-03-06 17:36:51 +00:00
Dmitri Gribenko 15225aee17 Driver: add support for new style multiarch in Ubuntu 13.04
Patch by Sanne Wouda.

llvm-svn: 176557
2013-03-06 17:14:05 +00:00
Edwin Vane 0a4836ed0e New ASTMatchers and enhancement to hasOverloadedOperatorName
Added two new narrowing matchers:
* hasMethod: aplies a matcher to a CXXRecordDecl's methods until a match is made
  or there are no more methods.
* hasCanonicalType: applies a matcher to a QualType's canonicalType.

Enhanced hasOverloadedOperatorName to work on CXXMethodDecl as well as
CXXOperatorCallExpr.

Updated tests and docs.

Reviewers: klimek, gribozavr
llvm-svn: 176556
2013-03-06 17:02:57 +00:00
Alexey Samsonov a1c0a2a2c6 [Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
llvm-svn: 176550
2013-03-06 10:54:18 +00:00
Weiming Zhao ff2a3ad81b revert r176531 due to clan-native-arm fails
llvm-svn: 176544
2013-03-06 02:08:54 +00:00
Richard Smith 5afcdf3f1c PR15390: If a function returns a pointer to a function, that function type
can't have default arguments even though it's a parameter-declaration-clause in
a function declaration.

llvm-svn: 176542
2013-03-06 01:37:38 +00:00
Richard Smith 7b24254e91 After issuing a diagnostic for undefining or redefining a builtin macro,
continue parsing the directive rather than silently discarding it.

Allowing undef or redef of __TIME__ and __DATE__ is important to folks
who want stable, reproducible builds.

llvm-svn: 176540
2013-03-06 00:46:00 +00:00
Fariborz Jahanian 47ef466b0f objective-C: don't crash after diagnosing
using object subscripting without declaring objectForKeyedSubscript:
// rdar://13333205

llvm-svn: 176539
2013-03-06 00:37:40 +00:00
Douglas Gregor 551eedbd27 Remove unused static variable.
llvm-svn: 176535
2013-03-05 23:59:13 +00:00
Jordan Rose 67b66231a8 Preprocessor: don't keep comments under -traditional-cpp.
This patch is designed for minimal intrusion into normal preprocessing
and compilation; under -E -traditional-cpp, the lexer will still
generate tok::comment nodes since it is preserving all whitespace, but
the output printer will then throw it away.

<rdar://problem/13338680>

llvm-svn: 176534
2013-03-05 23:54:55 +00:00
Weiming Zhao a35cc6fb6b PR 11326: Lack diagnosic message when ABI conflicts on ARM
When both Triple and -mabi are used, it may result into conflicting ABI value.

llvm-svn: 176531
2013-03-05 23:27:21 +00:00
Fariborz Jahanian a668bf548d fix a missing check in my last patch.
// rdar://13094352

llvm-svn: 176529
2013-03-05 23:20:29 +00:00
Jordan Rose 864b810739 Preprocessor: don't consider // to be a line comment in -E -std=c89 mode.
It's beneficial when compiling to treat // as the start of a line
comment even in -std=c89 mode, since it's not valid C code (with a few
rare exceptions) and is usually intended as such. We emit a pedantic
warning and then continue on as if line comments were enabled.
This has been our behavior for quite some time.

However, people use the preprocessor for things besides C source files.
In today's prompting example, the input contains (unquoted) URLs, which
contain // but should still be preserved.

This change instructs the lexer to treat // as a plain token if Clang is
in C90 mode and generating preprocessed output rather than actually compiling.

<rdar://problem/13338743>

llvm-svn: 176526
2013-03-05 22:51:04 +00:00
Fariborz Jahanian 56fe4066e5 doc. parsing. Improve on diagnostics on my last patch.
// rdar://13094352.

llvm-svn: 176525
2013-03-05 22:46:07 +00:00
Richard Smith 115314926d Remove outdated claim that GCC builds without a C++ compiler from compilers comparison.
llvm-svn: 176515
2013-03-05 21:49:52 +00:00
Lang Hames 224ae88bc3 Use ASTContext::getDeclAlign(<Field Decl>) to get the alignment of the first
field to be memcpy'd, rather instead of ASTContext::getTypeAlign(<Field Type>).
For packed structs the alignment of a field may be less than the alignment of
the field's type.

<rdar://problem/13338585>

llvm-svn: 176512
2013-03-05 20:27:24 +00:00
Argyrios Kyrtzidis 37f2ab4824 [libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.
llvm-svn: 176511
2013-03-05 20:21:14 +00:00
Fariborz Jahanian 43c8df8153 Fix this checkin.
llvm-svn: 176510
2013-03-05 19:52:24 +00:00