Commit Graph

5636 Commits

Author SHA1 Message Date
Zhongxing Xu cb131542f1 make CallGraph more flexible by letting it accept ASTContext instead of ASTUnit.
Patch by Simone Pellegrini.

llvm-svn: 85386
2009-10-28 12:23:03 +00:00
Fariborz Jahanian ef8b8ce207 Type of a conditional expression with two distinct objective-c
class pointer is the most derived common class of the two.
This is <rdar://problem/7334235>.

llvm-svn: 85337
2009-10-27 23:02:38 +00:00
Douglas Gregor 583dcafce4 Introduce FunctionDecl::isInlined() to tell whether a function should
be inlined.

llvm-svn: 85307
2009-10-27 21:11:48 +00:00
Douglas Gregor 35b5753e17 Rename FunctionDecl::isInline/setInline to
FunctionDecl::isInlineSpecified/setInlineSpecified.

llvm-svn: 85305
2009-10-27 21:01:01 +00:00
Douglas Gregor afca3b4a5c Explicit instantiation suppresses the instantiation of non-inline
function template specializations and member functions of class
template specializations.

llvm-svn: 85300
2009-10-27 20:53:28 +00:00
Douglas Gregor 1d957a336f An explicit instantiation definition only instantiations those class
members that have a definition. Also, use
CheckSpecializationInstantiationRedecl as part of this instantiation
to make sure that we diagnose the various kinds of problems that can
occur with explicit instantiations.

llvm-svn: 85270
2009-10-27 18:42:08 +00:00
Rafael Espindola 177f1d979d Split AddDefaultSystemIncludePaths into C, C++ and framework specific functions.
The user visible changes are:

*) Frameworks are only searched on OS X
*) The Cygwin c++ headers are now marked as c++ aware. I am almost
sure that not marking them was a bug.

llvm-svn: 85240
2009-10-27 14:47:31 +00:00
Steve Naroff 6231f18793 Add support for 'CXFile' (<rdar://problem/7303360>).
- 4 new functions (clang_getCursorSourceFile, clang_getDeclSourceFile, clang_getFileName, clang_getFileTime).

- Should remove clang_getDeclSource() and clang_getCursorSource(). For now, just put 'deprecate' comment in header. 

- Also changed CXX style comment to C style (to eliminate warning).

llvm-svn: 85238
2009-10-27 14:35:18 +00:00
John Thompson de258b5ab9 Changes for building as a Windows DLL
llvm-svn: 85234
2009-10-27 13:42:56 +00:00
Sebastian Redl 4461507151 Implement Chris's suggestions for the precendence warnings. Reformat the code a bit. Test the fixits.
llvm-svn: 85231
2009-10-27 12:10:02 +00:00
Mike Stump 5183a14bfb __builtin_object_size refinements. Also handle stack based objects. WIP.
llvm-svn: 85174
2009-10-26 23:05:19 +00:00
Sebastian Redl 4afb7c58a4 Add fixit hint to bitwise precedence warning.
llvm-svn: 85129
2009-10-26 17:01:32 +00:00
Sebastian Redl 4302824fe2 Implement a warning for mixing bitwise logical with comparison ops. Fixes PR5297.
llvm-svn: 85117
2009-10-26 15:24:15 +00:00
Rafael Espindola b3549d74da Rename -nostdclanginc to -nobuiltininc.
llvm-svn: 85116
2009-10-26 13:36:57 +00:00
Chandler Carruth a3f084ce16 Update location of DataTypes.h to reflect move in LLVM with r85086.
llvm-svn: 85087
2009-10-26 01:37:10 +00:00
Chris Lattner c0c043903b rename getTypeSigned() -> isTypeSigned() per daniel's review.
llvm-svn: 85076
2009-10-25 22:49:18 +00:00
Chris Lattner de126cfa83 cleanups
llvm-svn: 85069
2009-10-25 22:05:13 +00:00
Sebastian Redl d7b3d7dd79 Remove the Skip parameter from GetTypeForDeclarator and dependents. Take the opportunity to improve an error message and fix PR4498.
llvm-svn: 85068
2009-10-25 21:45:37 +00:00
Chris Lattner 1fb66f4323 change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead
of ConvertDeclSpecToType, which I'd like to keep private to SemaType.cpp.
We do this by cons'ing up a trivial Declarator for the type.

John, please review.

llvm-svn: 85060
2009-10-25 17:47:27 +00:00
Chris Lattner 5566290b34 In objc mode, every identifier in a cast expression was using doing a
type looking using getTypeName() and every property access was using
NextToken() to do lookahead to see if the identifier is followed by
a '.'.  Rearrange this code to not need lookahead and only do the
type lookup if we have "identifier." in the token stream.  Also
improve a diagnostic a bit.

llvm-svn: 85056
2009-10-25 17:04:48 +00:00
Benjamin Kramer 3f81d655d7 Remove duplicated constructor declaration.
llvm-svn: 84997
2009-10-24 10:09:11 +00:00
John McCall 703a3f8a7b Preserve type source information in TypedefDecls. Preserve it across
template instantiation.  Preserve it through PCH.  Show it off to the indexer.

I'm healthily ignoring the vector type cases because we don't have a sensible
TypeLoc implementation for them anyway.

llvm-svn: 84994
2009-10-24 08:00:42 +00:00
John McCall 48f2d5860d Store the builtin types as CanQualTypes. Expand a bit on the CanQual API,
but also remove some methods that cause ambiguities, and generally
make CanQual<blah> more analogous to QualType.

llvm-svn: 84976
2009-10-23 23:03:21 +00:00
John McCall 856bbea332 Remove OriginalTypeParmDecl; the original type is the one specified
in the DeclaratorInfo, if one is present.

Preserve source information through template instantiation.  This is made
more complicated by the possibility that ParmVarDecls don't have DIs, which
is possibly worth fixing in the future.

Also preserve source information for function parameters in ObjC method
declarations.

llvm-svn: 84971
2009-10-23 21:48:59 +00:00
John McCall 3665e00c87 Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.

llvm-svn: 84970
2009-10-23 21:14:09 +00:00
Fariborz Jahanian 9a14b84ac5 Diagnose misuse of '.*' and '->*' operators during parse
instead of crashing in code gen.

llvm-svn: 84968
2009-10-23 21:01:39 +00:00
Sebastian Redl f212a92bb6 Fix operator precedence in Doug's most recent commit.
llvm-svn: 84964
2009-10-23 19:38:17 +00:00
Douglas Gregor 4bd90e53c2 Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g., 

  namespace N { int i; }
  int j = N::i;

Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.

Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.

llvm-svn: 84962
2009-10-23 18:54:35 +00:00
John McCall fc93cf9777 When building types from declarators, instead of building two types (one for
the DeclaratorInfo, one for semantic analysis), just build a single type whose
canonical type will reflect the semantic analysis (assuming the type is
well-formed, of course).

To make that work, make a few changes to the type system:
* allow the nominal pointee type of a reference type to be a (possibly sugared)
  reference type.  Also, preserve the original spelling of the reference type.
  Both of these can be ignored on canonical reference types.
* Remove ObjCProtocolListType and preserve the associated source information on
  the various ObjC TypeLocs.  Preserve the spelling of protocol lists except in
  the canonical form.
* Preserve some level of source type structure on parameter types, but
  canonicalize on the canonical function type.  This is still a WIP.

Drops code size, makes strides towards accurate source location representation,
slight (~1.7%) progression on Cocoa.h because of complexity drop.

llvm-svn: 84907
2009-10-22 22:37:11 +00:00
John McCall b692a098c6 Canonicality is a property of qualified types, not unqualified types.
llvm-svn: 84891
2009-10-22 20:10:53 +00:00
Ted Kremenek a96b72a4ca Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
llvm-svn: 84873
2009-10-22 17:22:53 +00:00
Douglas Gregor d019ff686c When building and instantiating a template-id reference expression, such as
N::f<int>

keep track of the full nested-name-specifier. This is mainly QoI and
relatively hard to test; will try to come up with a printing-based
test once we also retain the explicit template arguments past overload
resolution.

llvm-svn: 84869
2009-10-22 17:20:55 +00:00
Mike Stump e1b19ba05b Extend out the block descriptor structure for debug information with
the copy/dispose helpers as appropriate.

llvm-svn: 84817
2009-10-22 00:49:09 +00:00
Ted Kremenek 649bf5c04b Enhance 'clang_createTranslationUnitFromSourceFile()' in two ways:
(1) Allow the source file to be specified in the actual command line arguments by allowing the
    caller to set 'source_filename' to NULL.

(2) Automatically strip off the arguments '-emit-ast', '-fsyntax-only', and '-c'.

llvm-svn: 84802
2009-10-22 00:03:57 +00:00
Mike Stump 9496790211 Complete out debug info generation for captured __block variables. WIP.
llvm-svn: 84768
2009-10-21 18:16:27 +00:00
Douglas Gregor 26b9178a50 Downgrade "function declared 'noreturn' should not return" from an
error (by default) to a warning, per C++0x [dcl.attr.noreturn]. Patch
from Sean Hunt!

llvm-svn: 84762
2009-10-21 15:46:01 +00:00
Steve Naroff 20bad0b7c6 Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up searching). Without a 'relativeDecl', the algorithm is n-squared. For example, running the following command on 'Large.m' takes hours without a 'relatvieDecl'.
snaroff% time ../../Debug/bin/c-index-test Large.ast all > Large.out
snaroff% cat Large.m
#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import <OpenGL/OpenGL.h>

With a 'relativeDecl', it takes <30 seconds:-)

llvm-svn: 84760
2009-10-21 13:56:23 +00:00
Chris Lattner 72cdcacb02 add helpful methods to TargetInfo for querying builtin integer type properties,
patch by Ken Dyck!

llvm-svn: 84746
2009-10-21 06:24:21 +00:00
Douglas Gregor 74ba25ca5a Improve diagnostics and template instantiation behavior when calling
an overloaded function call operator.

llvm-svn: 84745
2009-10-21 06:18:39 +00:00
Chris Lattner 6720492c39 hookize wint_t's definition, patch by Edward O'Callaghan (from PR5233).
llvm-svn: 84740
2009-10-21 04:59:34 +00:00
Mike Stump 7fe9cc1dd5 Prep work to always preallocate BlockDeclRefExprs so that we can
generate the debug information for the first parameter to the block
invoke functions.  WIP.

llvm-svn: 84737
2009-10-21 03:49:08 +00:00
John McCall 26fe7e0b8a Add TypeLocBuilder, an API for incrementally creating TypeLocs. Change
the API for creating DeclaratorInfos to allow callers to provide an exact
size.

llvm-svn: 84715
2009-10-21 00:23:54 +00:00
John McCall e4bdb93570 Publicize getSigilLoc / setSigilLoc for better metaprogramming.
Fix the ReferenceTypeLoc hierarchy.

llvm-svn: 84714
2009-10-21 00:21:09 +00:00
Ted Kremenek d45ff6cced Add destructor and cleanup code to LocationContext (fixing some leaks). Along the way, have
AnalysisManager periodically cleanup its AnalysisContextManager and LocationContextManager objects,
as they don't need to forever retain all the CFGs ever created when analyzing a file.

llvm-svn: 84684
2009-10-20 21:39:41 +00:00
Fariborz Jahanian b14d70413f Changed text of warning in my last patch.
Related to radar:
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions

llvm-svn: 84647
2009-10-20 17:24:11 +00:00
Fariborz Jahanian 040d75d9b6 Issue warning if method body starts with a semicolon.
Fixes 
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions

llvm-svn: 84645
2009-10-20 16:39:13 +00:00
Steve Naroff bb4568a37d Add an example to help claify the process/assumptions...
llvm-svn: 84642
2009-10-20 16:36:34 +00:00
Steve Naroff 531e284064 - Extend clang_createIndex() to support PCH and diagnostic 'filtering'. This seems cleaner to me without sacrificing much flexibility.
- Remove clang_wantOnlyLocalDeclarations().

- Remove 'displayDiagnostics' arguments to clang_createTranslationUnitFromSourceFile() and clang_createTranslationUnit().

- Have clang_createTranslationUnitFromSourceFile() strip the '-o <outfile>' command line arguments if they exist. Document this semantic in the header. Also verify we have a valid ASTUnit before telling it to 'unlinkTemporaryFile()'.

llvm-svn: 84634
2009-10-20 14:46:24 +00:00
Ted Kremenek cbd395c898 BumpVectorContext: Use 'unsigned' integer type with PointerIntUnion instead of bool to keep it clear that we are reasoning about an unsigned integer with a single bit.
llvm-svn: 84607
2009-10-20 05:49:17 +00:00
Chris Lattner c243f299ce teach FormatDiagnostic to aggregate previously formatted arguments and
pass them down into the ArgToStringFn implementation.  This allows 
redundancy across operands to a diagnostic to be eliminated.

This isn't used yet, so no functionality change.

llvm-svn: 84602
2009-10-20 05:25:22 +00:00