Граф коммитов

42888 Коммитов

Автор SHA1 Сообщение Дата
Rafael Espindola 377830097a 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 01:42:44 +00:00
Rafael Espindola 58bd77f613 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176603 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 01:34:57 +00:00
Jordan Rose c236b7327f [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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 01:23:25 +00:00
Jordan Rose 962fbc4666 [analyzer] Clean up a few doc comments for ProgramState and CallEvent.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176600 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 01:23:14 +00:00
Adrian Prantl 4919de6a53 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 22:03:30 +00:00
Anna Zaks 42773d64f9 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176577 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 20:26:02 +00:00
Anna Zaks 713e075919 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176576 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 20:25:59 +00:00
Argyrios Kyrtzidis 398253ab0e [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176567 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 18:12:50 +00:00
Argyrios Kyrtzidis ed3802e5da [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176566 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 18:12:47 +00:00
Argyrios Kyrtzidis 36592b1fa3 [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once.
We can just re-use the one from HeaderFileInfoLookupTable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176565 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 18:12:44 +00:00
Argyrios Kyrtzidis 8bd50b169c [PCH] Remove a couple of fields from serialization::reader::HeaderFileInfoTrait that are not used for anything.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176564 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 18:12:41 +00:00
Fariborz Jahanian 26facface1 Spell Objective-C correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 17:55:30 +00:00
Fariborz Jahanian 88f070f99f say objective-C in the warning and streamline
several diagnostics into one. // rdar://13094352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176560 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 17:36:51 +00:00
Dmitri Gribenko f2e7c35ade Driver: add support for new style multiarch in Ubuntu 13.04
Patch by Sanne Wouda.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176557 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 17:14:05 +00:00
Edwin Vane 6a19a97e57 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176556 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 17:02:57 +00:00
Alexey Samsonov 7e73f94c10 [Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176550 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 10:54:18 +00:00
Weiming Zhao 360355db57 revert r176531 due to clan-native-arm fails
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 02:08:54 +00:00
Richard Smith 3cdbbdc532 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 01:37:38 +00:00
Richard Smith eed55e6061 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176540 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 00:46:00 +00:00
Fariborz Jahanian 75525c4cce objective-C: don't crash after diagnosing
using object subscripting without declaring objectForKeyedSubscript:
// rdar://13333205


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 00:37:40 +00:00
Douglas Gregor b4e82454b6 Remove unused static variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176535 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 23:59:13 +00:00
Jordan Rose cf2c2e9588 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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176534 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 23:54:55 +00:00
Weiming Zhao 46a2290c03 PR 11326: Lack diagnosic message when ABI conflicts on ARM
When both Triple and -mabi are used, it may result into conflicting ABI value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176531 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 23:27:21 +00:00
Fariborz Jahanian eb8f69f094 fix a missing check in my last patch.
// rdar://13094352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176529 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 23:20:29 +00:00
Jordan Rose 693fdfa069 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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176526 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 22:51:04 +00:00
Fariborz Jahanian 99a7057098 doc. parsing. Improve on diagnostics on my last patch.
// rdar://13094352.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 22:46:07 +00:00
Richard Smith f32e11dcec Remove outdated claim that GCC builds without a C++ compiler from compilers comparison.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176515 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 21:49:52 +00:00
Lang Hames 23742cd8c6 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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176512 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 20:27:24 +00:00
Argyrios Kyrtzidis 44f65a587e [libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176511 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 20:21:14 +00:00
Fariborz Jahanian ca76bf8a93 Fix this checkin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176510 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 19:52:24 +00:00
Fariborz Jahanian bca9788dba doc parsing. Add @method and @callback for
checkings and few other refactoring/cleanup.
// rdar://13094352.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176509 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 19:40:47 +00:00
Jack Carter 971023066c Mips specific inline assembler constraint 'R'
'R' An address that can be sued in a non-macro load or store.

Including missing positive test case and fixed typo for r176453.

Thanks to Richard Smith for catching this!

Jack



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176506 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 19:10:54 +00:00
Edwin Vane 7e6f23a02d Make LibASTMatchersTutorial code match text
Fixed code to match text. Slight adjustment for readability.

Author: Béatrice Creusillet


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176493 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 18:04:37 +00:00
Dmitri Gribenko ba6efd3419 Documentation: use code highlighting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176480 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 13:05:56 +00:00
David Chisnall ebed32cfd8 Add a test that we are passing the -fobjc-default-synthesize flag for Apple and
non-Apple platforms.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176477 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 11:20:04 +00:00
Richard Smith 3c5cd15da5 Don't emit calls to virtual [[noreturn]] functions as noreturn; overrides of a
[[noreturn]] function are not required to also be [[noreturn]]. We still emit
calls to virtual __attribute__((noreturn)) functions as noreturn; unlike GCC,
we do require overriders to also be noreturn for that attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176476 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 08:30:04 +00:00
David Blaikie 4b02dff7ae Add quotation marks to template names in diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 06:21:38 +00:00
Jordan Rose e09b8c41d0 scan-build: explicitly say "No bugs found" if there are no reports.
Patch by Martin Storsjo!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176472 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 02:33:08 +00:00
Jordan Rose 41f3f3a479 Silence a number of static analyzer warnings with assertions and such.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176469 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 01:27:54 +00:00
Fariborz Jahanian 2a268f2629 doc parsing. We want to issue a strong warning when
an @function comment is not followed by a function decl.
// rdar://13094352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176468 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 01:05:07 +00:00
Jordan Rose 5aff3f1e9a [analyzer] Don't let cf_audited_transfer override CFRetain semantics.
We weren't treating a cf_audited_transfer CFRetain as returning +1 because
its name doesn't contain "Create" or "Copy". Oops! Fortunately, the
standard definitions of these functions are not marked audited.

<rdar://problem/13339601>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176463 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 23:21:32 +00:00
Dmitri Gribenko 808383d2d6 Comment parsing: refactor handling of command markers in AST
* Use the term 'command marker', because the semantics of 'backslash' and 'at'
  commands are the same.  (Talking about 'at commands' makes them look like a
  special entity.)

* Sink the flag down into bitfields, reducing the size of AST nodes.

* Change the flag into an enum for clarity.  Boolean function parameters are
  not very clear.

* Add unittests for new tok::at_command tokens.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 23:06:15 +00:00
Bob Wilson 2503ebd2cf Add ARM v6m, v7m, and v7em architectures for Cortex-M series processors.
<rdar://problem/11314476>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176458 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 22:37:49 +00:00
Bob Wilson fc55345144 Tidy up lists of Cortex-A series processors, adding entries for A7.
Also fix a missing entry for cortex-r5 in one copy of getLLVMArchSuffixForARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176457 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 22:37:46 +00:00
Bob Wilson 532f5a9d64 Fix confused use of llvm::StringSwitch for armv7r architecture.
svn 170909 added support for cortex-r5 but in this case it was done
incorrectly. The last argument to StringSwitch.Cases() is the replacement
value, so by adding "cortex-r5" it changed the default cpu for armv7r to
cortex-r5 instead of cortex-r4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176456 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 22:37:43 +00:00
Jack Carter d2ab6d371e Mips specific inline assembler constraint 'R'
'R' An address that can be sued in a non-macro load or store.
This patch includes a positive test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176453 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 21:36:11 +00:00
Argyrios Kyrtzidis 1c1508b37b [PCH] In HeaderFileInfoTrait::EqualKey(), use FileManager::getFile() to compare two filenames, instead of llvm::sys::fs::equivalent().
llvm::sys::fs::equivalent() does 2 stat calls every time it's called. Use FileManager::getFile() to take advantage
of the stat caching that FileManager is providing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 20:33:40 +00:00
Dmitri Gribenko 8cc9c9d223 Comment parsing tests: move a test into a group of similar tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 20:23:16 +00:00
Fariborz Jahanian c9320095d0 [comment parsing] source fidelity for tparam command too.
// rdar://13066276


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 20:08:47 +00:00
Manuel Klimek 0090591e50 Make sure to not split string literals at the first character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 20:03:38 +00:00