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

6576 Коммитов

Автор SHA1 Сообщение Дата
John McCall a369a95f75 Implement -Wshadow for parameter declarations as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 04:12:52 +00:00
Daniel Dunbar 365b0bd389 Driver: Force joining of "-l" "foo", the linker doesn't eat that format.
<rdar://problem/7641151> clang must eat spaces after -l

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 01:12:03 +00:00
Eric Christopher 355c96ef5a Add include for smmintrin.h to this test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99019 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 01:06:48 +00:00
John McCall f746aa6a8f Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap.  Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board.  We'll see how it plays out.

Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99012 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 23:29:14 +00:00
Douglas Gregor 1b058e8956 Robustify PreprocessingRecord slightly, by only creating macro
instantiations when we have the corresponding macro definition and by
removing macro definition information from our table when the macro is
undefined. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:58:23 +00:00
Douglas Gregor 6a5a23f8e7 Implement serialization and lazy deserialization of the preprocessing
record (which includes all macro instantiations and definitions). As
with all lay deserialization, this introduces a new external source
(here, an external preprocessing record source) that loads all of the
preprocessed entities prior to iterating over the entities.

The preprocessing record is an optional part of the precompiled header
that is disabled by default (enabled with
-detailed-preprocessing-record). When the preprocessor given to the
PCH writer has a preprocessing record, that record is written into the
PCH file. When the PCH reader is given a PCH file that contains a
preprocessing record, it will be lazily loaded (which, effectively,
implicitly adds -detailed-preprocessing-record). This is the first
case where we have sections of the precompiled header that are
added/removed based on a compilation flag, which is
unfortunate. However, this data consumes ~550k in the PCH file for
Cocoa.h (out of ~9.9MB), and there is a non-trivial cost to gathering
this detailed preprocessing information, so it's too expensive to turn
on by default. In the future, we should investigate a better encoding
of this information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:51:54 +00:00
Fariborz Jahanian 8d52cbdce8 More coherent diagnostics when ivar is placed n categories.
(related to radar 7538989).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98993 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 21:25:51 +00:00
Ted Kremenek 86d07a11f1 Add test case for <rdar://problem/7770737>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 19:45:03 +00:00
John McCall a2936be04f Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 18:53:26 +00:00
Fariborz Jahanian d4c60909ae Diagnose conversion of 'Class' to/from objective-c
object pointer types.
Fixes radar 7634850.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98970 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 18:06:10 +00:00
John McCall 73061d0541 Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643.  Patch by Mike M!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 07:56:44 +00:00
Douglas Gregor 5de65721bd Fix a longstanding (but previously unknown) bug in the lazy
deserialization of precompiled headers, where the deserialization of
the source location entry for a buffer (e.g., macro instantiation
scratch space) would overwrite a one-element FileID cache in the
source manager. When tickled at the wrong time, we would return the
wrong decomposed source location and eventually cause c-index-test to
crash.

Found by dumb luck. It's amazing this hasn't shown up before.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98940 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 06:12:06 +00:00
Douglas Gregor 0396f46697 Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 05:22:59 +00:00
Bob Wilson 3178cb674a Revert 98907 since it is breaking buildbots.
--- Reverse-merging r98907 into '.':
D    test/Index/c-index-getCursor-pp.c
U    tools/CIndex/CIndex.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 03:57:57 +00:00
Douglas Gregor 2507fa8416 Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 00:18:31 +00:00
John McCall 7aceaf8cee When elevating access along an inheritance path, initialize the computed
access to the (elevated) access of the accessed declaration, if applicable,
rather than plunking that access onto the end after we've calculated the
inheritance access.

Also, being a friend of a derived class gives you public access to its
members (subject to later modification by further inheritance);  it does
not simply ignore a single location of restricted inheritance.

Also, when computing the best unprivileged path to a subobject, preserve
the information that the worst path might be AS_none (forbidden) rather
than a minimum of AS_private.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98899 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 23:49:19 +00:00
Douglas Gregor 3c26684d03 Try to appease MSVC's standard library
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:28:30 +00:00
Douglas Gregor 1a1f85a935 Try to appease MSVC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98875 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:25:12 +00:00
Ted Kremenek b03d33edaf Make PredefinedExpr::ComputeName() more robust to incorrect
code when we are printing the name of an Objective-C method
whose class has not been declared.  Fixes <rdar://problem/7495713>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98874 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:23:08 +00:00
Fariborz Jahanian 90c71268f0 Some cleanup, change diagnostic when assigning to
a property which is not lvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 18:50:41 +00:00
Douglas Gregor bf7efa2742 Explicitly link macro instantiations to macro definitions in the
preprocessing record. Use that link with clang_getCursorReferenced()
and clang_getCursorDefinition() to match instantiations of a macro to
the definition of the macro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 18:23:03 +00:00
Douglas Gregor 572feb2a19 Expose macro definitions as CIndex cursors. These can still only be
generated by clang_annotateTokens().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 18:04:21 +00:00
Douglas Gregor 4ae8f298b1 Introduce the notion of a "preprocessing record", which keeps track of
the macro definitions and macro instantiations that are found
during preprocessing. Preprocessing records are *not* generated by
default; rather, we provide a PPCallbacks subclass that hooks into the
existing callback mechanism to record this activity.

The only client of preprocessing records is CIndex, which keeps track
of macro definitions and instantations so that they can be exposed via
cursors. At present, only token annotation uses these facilities, and
only for macro instantiations; both will change in the near
future. However, with this change, token annotation properly annotates
macro instantiations that do not produce any tokens and instantiations
of macros that are later undef'd, improving our consistency.

Preprocessing directives that are not macro definitions are still
handled by clang_annotateTokens() via re-lexing, so that we don't have
to track every preprocessing directive in the preprocessing record.

Performance impact of preprocessing records is still TBD, although it
is limited to CIndex and therefore out of the path of the main compiler.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 17:52:52 +00:00
Douglas Gregor cb448d571b Defang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 15:37:47 +00:00
Douglas Gregor 4807231938 More token-annotation experimentation, preprocessing the annotated
token sequence to detect macro instantiations (that produce at least
token). WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98826 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 15:23:44 +00:00
Douglas Gregor a49f1afdfa Defang a test that's failing intermittently on windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98825 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 14:59:12 +00:00
John McCall 90c8c57bcd from code inspection, we were treating placement news with one argument as
non-placement news when selecting the corresponding operator delete;  this is
fixed.
Access and ambiguity control for calls to operator new and delete.  Also AFAICT



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98818 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 08:19:33 +00:00
John McCall 10f2873c0d Redeclaration lookups for parameter names should be flagged as redeclaration lookups
so they don't trigger diagnostics like (say) access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 06:42:38 +00:00
Ted Kremenek 8133716fc5 Refactor argument checking in CallAndMessageChecker to be the same
for both CallExprs and ObjCMessageExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 03:22:29 +00:00
Anders Carlsson 9135a84d8e When dumping vtables, also dump the thunks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98799 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 02:44:19 +00:00
Ted Kremenek 091b588f09 Detect pass-by-value arguments that are structs that contain
uninitialized data.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98796 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 02:17:27 +00:00
Ted Kremenek ebd42f4080 Tweak dead stores checker to not emit a warning when initialization
a scalar variable with a scalar parameter.  This is a
form of defensive programming.  If the variable is unused,
it will be caused by -Wunused-variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 01:22:39 +00:00
Douglas Gregor 9f1e3ff3b3 Experimental stab at using relexing to identify preprocessor
directives while annotating tokens in CIndex. This functionality
should probably be factored out of this routine, but we're not there
yet. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 00:42:48 +00:00
John McCall a742db0032 Implement non-dependent friend functions and classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 20:01:29 +00:00
Douglas Gregor 2399bed241 XFAIL this test on that silly Windows platform. Grrr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 18:28:02 +00:00
Douglas Gregor a69fa5fdcc Remove this test. It is causing problems has has relatively little value
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 16:04:04 +00:00
Douglas Gregor c48c916b8c Remove warning about shadowing a built-in; built-ins aren't actually
considered to be a part of the translation unit unless they're named
in a way that brings them into existence.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 16:03:44 +00:00
Douglas Gregor dbf8ee630e Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98727 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 15:44:30 +00:00
Douglas Gregor e39b600582 Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98725 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 15:30:15 +00:00
John McCall 88b6c71e3f Grant nested classes the access privileges of their enclosing classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 04:58:56 +00:00
Rafael Espindola 9b35b25db3 Correctly mangle dependent TypenameType.
Fixes PR6625.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 04:28:11 +00:00
John McCall 4ad287edcc Provide a test case for PR6629.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 01:31:25 +00:00
Fariborz Jahanian 132f2a2da3 objective-c patch to provide type safty when blocks are passing or
returning objc objects. There will be a corresponding objective-c++
patch soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 00:20:01 +00:00
Douglas Gregor 87bac6f3aa Emit output of PCH consistency checking test case to a separate text file and grep that
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98695 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 00:09:23 +00:00
Fariborz Jahanian 8596bbe00e Issue error when a byref array is accessed in a block
literal. Fixes radar 7760213.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 23:39:51 +00:00
Douglas Gregor c815108d08 Teach SourceManager's content cache to keep track of whether its
buffer was invalid when it was created, and use that bit to always set
the "Invalid" flag according to whether the buffer is invalid. This
ensures that all accesses to an invalid buffer are marked invalid,
improving recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98690 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 22:53:51 +00:00
Douglas Gregor 453091cc20 Audit all Preprocessor::getSpelling() callers, improving failure
recovery for those that need it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98689 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 22:30:13 +00:00
John McCall 9a8cb8d4bd Forgot the testcases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 21:50:59 +00:00
John McCall ef027fe748 Perform access control for the implicit calls to base and member destructors
that occur in constructors (on the unwind path).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 21:39:52 +00:00
Douglas Gregor 12fab31aa5 Fix header-search problems with precompiled headers, where the
presence or absence of header map arguments when using the precompiled
header would cause Clang to get confused about which headers had
already been included/imported, along with their controlling
macros. The fundamental problem is that the serialization of the
header search information was relying on the UIDs of FileEntry objects
at PCH generation time and PCH load time to be equivalent, which
effectively means that we had to probe the same files in the same
order. Differing header map arguments caused an extra FileEntry
lookup, but it's easy to imagine other minor command-line arguments
triggering this problem.

Header-search information is now encoded along with the
source-location entry for a file, so that we register information
about a file's properties as a header at the same time we create the
FileEntry for that file.

Fixes <rdar://problem/7743243>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 16:35:32 +00:00