Commit Graph

21436 Commits

Author SHA1 Message Date
Eric Christopher 86af0bae8a Add a newline at the end of the file.
llvm-svn: 99026
2010-03-20 01:19:04 +00:00
Eric Christopher 6ed351ab2d For legacy compatibility add a varargs.h header.
llvm-svn: 99025
2010-03-20 01:18:30 +00:00
Ted Kremenek 8a8e3e61aa Augment path diagnostics to include displaying when a message expression
is not evaluated because the receiver is nil.

llvm-svn: 99024
2010-03-20 01:17:30 +00:00
Daniel Dunbar ed45c3f2b9 Driver: Force joining of "-l" "foo", the linker doesn't eat that format.
<rdar://problem/7641151> clang must eat spaces after -l

llvm-svn: 99023
2010-03-20 01:12:03 +00:00
Daniel Dunbar 4ea3aea534 Driver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.
Also, simplify/fix SeparateArg::render with forced join.

llvm-svn: 99022
2010-03-20 01:12:00 +00:00
Daniel Dunbar aef1db1d71 Fix unused variable warning.
llvm-svn: 99021
2010-03-20 01:11:56 +00:00
Eric Christopher 33124e20c7 Migrate typedefs to the top level of xmmintrin.h and remove the same
one from emmintrin.h.

llvm-svn: 99020
2010-03-20 01:08:47 +00:00
Eric Christopher 576a9f2508 Add include for smmintrin.h to this test.
llvm-svn: 99019
2010-03-20 01:06:48 +00:00
Daniel Dunbar 47d25b18db Driver: Fix possible crash when targetting an unknown (unsupported) Darwin
platform, e.g. ppc.

llvm-svn: 99016
2010-03-20 00:50:21 +00:00
Douglas Gregor 3dc10b530e Optimize region-of-interest based cursor walks through the
preprocessed entities by grouping preprocessed entities by file
ID. This drastically improves performance of repeated
clang_getCursor() calls local tests, although it is a bit ugly.

llvm-svn: 99015
2010-03-20 00:41:21 +00:00
John McCall 7ec5043c2c 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.

llvm-svn: 99012
2010-03-19 23:29:14 +00:00
Douglas Gregor 9507d46d62 Remove the capture, serialization, and deserialization of comment
ranges as part of the ASTContext. This code is not and was never used,
but contributes ~250k to the size of the Cocoa.h precompiled
header.

llvm-svn: 99007
2010-03-19 22:13:20 +00:00
Douglas Gregor 8aaca67b0a 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. 

llvm-svn: 99004
2010-03-19 21:58:23 +00:00
Douglas Gregor aae9224e49 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.

llvm-svn: 99002
2010-03-19 21:51:54 +00:00
Fariborz Jahanian 5140920a48 More coherent diagnostics when ivar is placed n categories.
(related to radar 7538989).

llvm-svn: 98993
2010-03-19 21:25:51 +00:00
Ted Kremenek 00da3b9a80 Teach clang_getCursorKindSpelling() about CXCursor_InvalidCode.
llvm-svn: 98982
2010-03-19 20:39:05 +00:00
Ted Kremenek e184ac5a66 Make the CIndex API more resilient to being used on invalid code.
llvm-svn: 98981
2010-03-19 20:39:03 +00:00
Ted Kremenek c517974e9e Add test case for <rdar://problem/7770737>.
llvm-svn: 98979
2010-03-19 19:45:03 +00:00
Daniel Dunbar 1c201fbf73 clang -cc1: Kill off -empty-input only, and replace with -init-only which is an
actual action.
 - This is easier to use, and more reliable for timing the thing this was
   actually meant to be useful for.

llvm-svn: 98978
2010-03-19 19:44:04 +00:00
John McCall ce5cbdc4ff Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.

llvm-svn: 98975
2010-03-19 18:53:26 +00:00
Fariborz Jahanian d5bb8cb348 Diagnose conversion of 'Class' to/from objective-c
object pointer types.
Fixes radar 7634850.

llvm-svn: 98970
2010-03-19 18:06:10 +00:00
Douglas Gregor 7dc8722bd3 Make the preprocessing record a PPCallbacks subclass itself,
eliminating the extra PopulatePreprocessingRecord object. This will
become useful once we start writing the preprocessing record to
precompiled headers.

llvm-svn: 98966
2010-03-19 17:12:43 +00:00
Douglas Gregor 7f6d60dcc2 Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record.

llvm-svn: 98963
2010-03-19 16:15:56 +00:00
Douglas Gregor fc7a4813ab Try to improve computation of the main file name for debug
information, to address recent gdb failures.

llvm-svn: 98959
2010-03-19 14:49:09 +00:00
John McCall ef01f71a5a Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643.  Patch by Mike M!

llvm-svn: 98946
2010-03-19 07:56:44 +00:00
John McCall a0296f7987 Remember the "found declaration" for an overload candidate, which is the
entity (if applicable) which was actually looked up.  If a candidate was found
via a using declaration, this is the UsingShadowDecl;  otherwise, if
the candidate is template specialization, this is the template;  otherwise,
this is the function.

The point of this exercise is that "found declarations" are the entities
we do access control for, not their underlying declarations.  Broadly speaking,
this patch fixes access control for using declarations.

There is a *lot* of redundant code calling into the overload-resolution APIs;
we really ought to clean that up.

llvm-svn: 98945
2010-03-19 07:35:19 +00:00
Douglas Gregor 51c2351d30 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.

llvm-svn: 98940
2010-03-19 06:12:06 +00:00
Douglas Gregor 5272e80ce5 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.

llvm-svn: 98935
2010-03-19 05:22:59 +00:00
Bob Wilson 4f559a3042 Revert 98907 since it is breaking buildbots.
--- Reverse-merging r98907 into '.':
D    test/Index/c-index-getCursor-pp.c
U    tools/CIndex/CIndex.cpp

llvm-svn: 98929
2010-03-19 03:57:57 +00:00
Douglas Gregor 20004ee7d2 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.

llvm-svn: 98907
2010-03-19 00:18:31 +00:00
John McCall a332b953e8 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.

llvm-svn: 98899
2010-03-18 23:49:19 +00:00
Douglas Gregor c6b5a3df1e For debug information, get the main file name from the source manager
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.

llvm-svn: 98898
2010-03-18 23:46:43 +00:00
Douglas Gregor e56c353eb1 Try to appease MSVC's standard library
llvm-svn: 98878
2010-03-18 21:28:30 +00:00
Douglas Gregor 5810ead358 Try to appease MSVC
llvm-svn: 98875
2010-03-18 21:25:12 +00:00
Ted Kremenek 361ffd947c 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>.

llvm-svn: 98874
2010-03-18 21:23:08 +00:00
Ted Kremenek abb1dddfcd Add bounds check in PCHReader. when reading source file entry record
llvm-svn: 98873
2010-03-18 21:23:05 +00:00
Fariborz Jahanian 8342e5776e Some cleanup, change diagnostic when assigning to
a property which is not lvalue.

llvm-svn: 98848
2010-03-18 18:50:41 +00:00
Douglas Gregor 78ae2481b6 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.

llvm-svn: 98842
2010-03-18 18:23:03 +00:00
Douglas Gregor 06d6d32762 Expose macro definitions as CIndex cursors. These can still only be
generated by clang_annotateTokens().

llvm-svn: 98837
2010-03-18 18:04:21 +00:00
Douglas Gregor 065f8d11ca 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.

llvm-svn: 98836
2010-03-18 17:52:52 +00:00
Benjamin Kramer 966e934b34 Replace some SmallVectors with arrays.
llvm-svn: 98833
2010-03-18 16:59:57 +00:00
Douglas Gregor 1793c07114 Defang
llvm-svn: 98827
2010-03-18 15:37:47 +00:00
Douglas Gregor 02ded2a56c More token-annotation experimentation, preprocessing the annotated
token sequence to detect macro instantiations (that produce at least
token). WIP.

llvm-svn: 98826
2010-03-18 15:23:44 +00:00
Douglas Gregor 48d75d1bda Defang a test that's failing intermittently on windows
llvm-svn: 98825
2010-03-18 14:59:12 +00:00
Kovarththanan Rajaratnam 8fc5a80905 Fix 80 col violation
llvm-svn: 98823
2010-03-18 13:56:20 +00:00
Kovarththanan Rajaratnam 5a487710b5 Simply tags target
llvm-svn: 98822
2010-03-18 13:52:43 +00:00
John McCall fb6f52671a 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

llvm-svn: 98818
2010-03-18 08:19:33 +00:00
Kovarththanan Rajaratnam 5497e49ae4 Make some typedefs private
llvm-svn: 98817
2010-03-18 07:45:30 +00:00
Kovarththanan Rajaratnam 3fd8082ff5 Rename variable to indicate what it is being used for
llvm-svn: 98816
2010-03-18 07:18:10 +00:00
John McCall 84f0267301 Redeclaration lookups for parameter names should be flagged as redeclaration lookups
so they don't trigger diagnostics like (say) access control.

llvm-svn: 98806
2010-03-18 06:42:38 +00:00