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

6098 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar 984eb8611d Driver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 21:07:25 +00:00
Chris Lattner b9f709665a Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:59:08 +00:00
Sebastian Redl 31310a21fb In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:16:42 +00:00
John McCall 342fec43c5 Note that an overload candidate was non-viable because template argument
deduction failed.  Right now there's a very vague diagnostic for most cases
and a good diagnostic for incomplete deduction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 18:53:26 +00:00
Sam Weinig d17e340e2d Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 05:02:49 +00:00
John McCall b13b737a24 Access checking for implicit user-defined conversions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 03:16:54 +00:00
Sebastian Redl e9d12b6c50 Add VarDecl::isThisDeclarationADefinition(), which properly encapsulates the logic for when a variable declaration is a (possibly tentativ) definition. Add a few functions building on this, and shift C tentative definition handling over to this new functionality. This shift also kills the Sema::TentativeDefinitions map and instead simply stores all declarations in the renamed list. The correct handling for multiple tentative definitions is instead shifted to the final walk of the list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94968 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 22:27:38 +00:00
Anders Carlsson 093802675b Diagnose binding a non-const reference to a vector element.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94963 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 17:18:49 +00:00
Chandler Carruth 038cc39994 Fix PR6159 and several other problems with value-dependent non-type template
arguments. This both prevents meaningless checks on these arguments and ensures
that they are represented as an expression by the instantiation.

Cleaned up and added standard text to the relevant test case. Also started
adding tests for *rejected* cases. At least one FIXME here where (I think) we
allow something we shouldn't. More to come in the area of rejecting crazy
arguments with decent diagnostics. Suggestions welcome for still better
diagnostics on these errors!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 10:01:20 +00:00
Douglas Gregor 9db7dbb918 Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

  - CXXBaseOrMemberInitializer now contains only a single initializer
    rather than a set of initialiation arguments + a constructor. The
    single initializer covers all aspects of initialization, including
    constructor calls as necessary but also cleanup of temporaries
    created by the initializer (which we never handled
    before!).

  - Rework + simplify code generation for CXXBaseOrMemberInitializers,
    since we can now just emit the initializer as an initializer.

  - Switched base and member initialization over to the new
    initialization code (InitializationSequence), so that it

  - Improved diagnostics for the new initialization code when
    initializing bases and members, to match the diagnostics produced
    by the previous (special-purpose) code.

  - Simplify the representation of type-checked constructor initializers in
    templates; instead of keeping the fully-type-checked AST, which is
    rather hard to undo at template instantiation time, throw away the
    type-checked AST and store the raw expressions in the AST. This
    simplifies instantiation, but loses a little but of information in
    the AST.

  - When type-checking implicit base or member initializers within a
    dependent context, don't add the generated initializers into the
    AST, because they'll look like they were explicit.

  - Record in CXXConstructExpr when the constructor call is to
  initialize a base class, so that CodeGen does not have to infer it
  from context. This ensures that we call the right kind of
  constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

  - Diagnose default-initialization of a const-qualified class that
    does not have a user-declared default constructor. We had this
    diagnostic specifically for bases and members, but missed it for
    variables. That's fixed now.

  - When defining the implicit constructors, destructor, and
    copy-assignment operator, set the CurContext to that constructor
    when we're defining the body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 09:12:51 +00:00
Anders Carlsson 966146e891 Remove the SmallVectors from AsmStmt. Fixes PR6105.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:19:41 +00:00
Anders Carlsson ff93dbd887 Use IdentifierInfo * instead of std::string for the AsmStmt names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 22:25:16 +00:00
Daniel Dunbar 807b06157a ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
live as long as the ASTUnit. This is useful for clients which want to maintain
pointers to the LangOptions object which ultimately lives in the
CompilerInvocation, although it would be nice to make all of this ownership
stuff more explicit and obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 21:47:16 +00:00
Daniel Dunbar 6228ca0012 CompilerInstance: Change to not contain the CompilerInvocation object.
This allows clients to install their own CompilerInvocation object, which is
important for clients that may wish to create references to things like
LangOptions whose lifetime will extend past that of the CompilerInstance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 21:47:07 +00:00
Anders Carlsson acb6bcb442 Even more AsmStmt cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 20:38:10 +00:00
Anders Carlsson a5a79f7d16 More asm cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 20:05:21 +00:00
Anders Carlsson fdba9c0690 Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 19:34:25 +00:00
Anders Carlsson 83c021c6d3 Yay for more StringRefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 19:12:25 +00:00
Anders Carlsson f959fb5fb8 StringRef-ize the TargetInfo::ConstraintInfo constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 18:33:31 +00:00
Daniel Dunbar 01aefc6d20 Recognize 'q' as a format length modifier (from BSD).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 15:49:20 +00:00
Benjamin Kramer f22d1fd96d Use StringRef instead of returning a temporary std::string.
This fixes a really nasty bug in Darwin::getDarwinArchName where we were going
StringRef -> temporary std::string -> StringRef (and return the dead StringRef).
The StringRefs from Triple live as long as the Triple itself, that should be
long enough.

Hopefully 2 of 4 MSVC buildbot failures are gone now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94892 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 15:01:47 +00:00
Benjamin Kramer 500f189081 Silence clang++ warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 12:15:41 +00:00
Ted Kremenek d635c5fcc4 Add basic type checking of format string conversion specifiers and their arguments. Thanks to Cristian Draghici for his help with this patch!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94864 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 00:49:51 +00:00
Ted Kremenek 33567d2feb Per a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 22:59:32 +00:00
Ted Kremenek f88c8e02da Switch Sema over to using the new implementation of format string
checking.  It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 20:55:36 +00:00
Ted Kremenek 4dcb18ff9d Enhancements to the alternate (WIP) format string checking:
- Add ConversionSpecifier::consumesDataArgument() as a helper method
  to determine if a conversion specifier requires a matching argument.
- Add support for glibc-specific '%m' conversion
- Add an extra callback to HandleNull() for locations within the
  format specifier that have a null character


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 20:29:53 +00:00
Douglas Gregor ef06e2451c Fix reference-binding when we have a reference to const volatile type;
previously, we were allowing this to bind to a temporary. Now, we
don't; add test-cases and improve diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 19:39:15 +00:00
Benjamin Kramer ddc6b664e4 Fix typo found by clang++. Yay for -Wuninitialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 15:58:21 +00:00
Anders Carlsson 4e1c181e2b Add getters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 06:34:33 +00:00
Anders Carlsson e6d2a53485 Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94798 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 05:05:36 +00:00
Ted Kremenek 808015a18b Alternate format string checking: issue warnings for incomplete format specifiers.
In addition, move ParseFormatString() and FormatStringHandler() from
the clang::analyze_printf to the clang namespace.  Hopefully this will
resolve some link errors on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 03:16:21 +00:00
Ted Kremenek 26ac2e07b4 Alternate format string checking: issue a warning for invalid conversion specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:40:24 +00:00
Anders Carlsson eb60edffa1 Add an CXXBindReferenceExpr (not used just yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 02:39:32 +00:00
John McCall 80cd64a845 Do a little magic and a little greasework to make it much more efficient
to cast a DeclContext down to a specific implementation class.

There are still lots of calls to Decl::castFromDeclContext left, mostly
arising from DeclContext::getParent().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:45:37 +00:00
Ted Kremenek e82d804ee7 Alternate format string checking: warn of '%n' as being potentially insecure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:35:25 +00:00
Ted Kremenek 0d27735c51 Add precision/field width checking to AlternateCheckPrintfString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 01:06:55 +00:00
Douglas Gregor 51c6d38455 When printing diagnostics in c-index-test, also print source ranges
and fix-it information, so we can see everything in one place. Along
the way, fix a few bugs with deserialization and query of diagnostics
in CIndex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 00:41:11 +00:00
John McCall 233a641909 Access control for surrogate function calls. Required a moderately gross hack
to get the access bits set properly in conversion sets.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94744 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 07:38:46 +00:00
Douglas Gregor d93256e556 Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 06:00:51 +00:00
Ted Kremenek a8d8fec787 Add position of conversion specifier character to 'ConversionSpecifier'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 02:46:17 +00:00
Ted Kremenek d2dcece588 Rename namespace clang::printf to clang::analyze_printf to avoid problems where the reference to 'printf' is ambiguous.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94733 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 02:02:59 +00:00
Fariborz Jahanian 7e20ffe322 Fixes a rewrite bug rewriting nested ivars reference.
(Radar 7583971).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94724 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 01:41:20 +00:00
Ted Kremenek d5f2096e26 Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94715 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 01:00:59 +00:00
Douglas Gregor 936ea3b590 Switch the remaining diagnostic printing in CIndex over to the
diagnostic callback mechanism, so all diagnostics now go through that
callback. Also, eliminate the displayDiagnostics flag to
clang_createIndex(), since it is no longer necessary: the client
determines whether to display diagnostics or not.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94714 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 00:56:43 +00:00
Ted Kremenek c7cbb9bf8e Add '@' conversion specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 00:55:28 +00:00
Douglas Gregor 5352ac06d8 Implement a diagnostics callback for the C interface to Clang, so that
clients can format diagnostics as they wish rather than having to
parse standard error. All of the important parts of the front end's
diagnostics are exposed: text, severity, location, source ranges, and
fix-its. The diagnostics callback is now available with
clang_createTranslationUnitFromSource() and
clang_createTranslationUnit().

As part of this change, CXSourceLocation and CXSourceRange got one
pointer larger, since we need to hold on to the SourceManager and
LangOptions structures in the source location. This is the minimum
amount of information needed for the functions that operate on source
locations and ranges (as implemented now). Previously we held on to
the ASTContext, but the diagnostics callback can end up with source
locations when there is no ASTContext (or preprocessor).

Still to do:
  - Code completion needs to support the diagnostics callback, once we
  have the ability to (de-)serialize diagnostics.
  - Eliminate the "displayDiagnostics" argument to createIndex; we'll
  always pass diagnostics to the callback and let it deal with display.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 00:27:43 +00:00
Ted Kremenek 8f0a1c73fd Add skeleton for a more structured way to analyzing pring format
strings than what we currently have in Sema.  This is both an
experiment and a WIP.

The idea is simple: parse the format string incrementally,
constructing a well-structure representation of each format specifier.
Each format specifier is then handed back one-by-one to a client via a
callback.  Malformed format strings are also handled with callbacks.
The idea is to separate the parsing of the format string from the
emission of diagnostics.  Currently what we have in Sema for handling
format strings is a mongrel of both that is hard to follow and
difficult to modify (I can apply this label since I'm the original
author of that code).

This is in libAnalysis as it is reasonable generic and can potentially
be used both by libSema and libChecker.

Comments welcome.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 23:43:25 +00:00
Ted Kremenek 78acdbfb52 Move more naming conventions logic out of the retain/release checker to CocoaConventions.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 18:00:17 +00:00
Ken Dyck 8b752f10c3 Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 17:10:57 +00:00
Chandler Carruth 9d883b5b37 Silence a GCC warning about uninitialized variables. The first user of this
showed up with a primitive type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94674 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 10:28:04 +00:00
Ted Kremenek a64e89bbfa Start pulling out pieces of the monolithic retain/release checker into
reusable and modular API pieces.

Start by pulling the logic for deriving the Cocoa naming convention
into a separate API, header, and source file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 06:13:48 +00:00
Anders Carlsson 3a18917b52 It's not Explicit anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 03:27:53 +00:00
John McCall c373d48502 Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 01:50:18 +00:00
Daniel Dunbar f7b33749d2 Support -marm by treating it as an alias for -mno-thumb.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 01:06:14 +00:00
Daniel Dunbar 5cc0251973 Driver/Darwin: Disallow -m{macosx,iphoneos}-version-min as -Xarch arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 00:56:31 +00:00
Ted Kremenek 13e635c55e Add const version of ObjCMethodDecl::getCanonicalDecl().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 00:37:54 +00:00
Ted Kremenek fee90811c6 Teach RegionStore to handle initialization of incomplete arrays in structures using a compound value. Fixes <rdar://problem/7515938>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94622 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 23:51:00 +00:00
Ted Kremenek 97053091c0 Move 'LocalCheckers.h' to the 'Checkers' subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 22:59:55 +00:00
Ted Kremenek f12d31999e Move 'include/Checkers/PathSensitive/Checkers' directory to 'include/Checkers'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94608 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 22:56:15 +00:00
Fariborz Jahanian 013af39d2a Patch to add 'volatile' to first argument of all
sync compare_and_swap to match them with gcc.
It also fixes a few incorrect argument defitions.
(fixes radar 7540291).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94607 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 22:48:42 +00:00
Sebastian Redl 7783bfc066 Bring some semblance of order into Decl.h and Decl.cpp. While at it, fix some typo comments and remove an unused and unimplemented function prototype. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 22:01:41 +00:00
Ted Kremenek 16b55a7169 Implement 'clang_getInclusions()' in CIndex. This API allows clients to walk the set of files included in a translation unit via the C API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94575 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:31:51 +00:00
Douglas Gregor 46766dc31c Eliminate clang_getInstantiationLocationOffset(), and instead add an
offset parameter to clang_getInstantiationLocation(). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94573 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:19:08 +00:00
Douglas Gregor 0045e9fe1f Implement clang_annotateTokens(), which associates cursors with each
of the tokens within a raw token stream. This does not even attempt to
handle macros yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 18:31:56 +00:00
Anders Carlsson 3bb92693c3 Use the right definition when emitting a global variable. Fixes PR5564.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:43:42 +00:00
Ken Dyck 16e20cce43 Correct cut-and-paste error in doxygen comment for newly introduced
getTypeAlignInChars().  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94553 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:25:18 +00:00
Ken Dyck 86fa4311c8 Add getTypeAlignInChars() for use in code that works in alignments in character
units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94552 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:22:55 +00:00
Douglas Gregor fc8ea23eb6 Introduce a CIndex API for lexing the raw tokens within a given source
range. The token-annotation function does nothing, yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:06:03 +00:00
Ken Dyck b896f625d1 Replace inheritance of RegionRawOffset from std::pair with two private member
variables to improve readability and encapsulation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:01:47 +00:00
John McCall 7534516353 Avoid some unnecessary copying of unresolved lookup results.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 07:37:41 +00:00
John McCall 6e26689f5d Preserve access bits through overload resolution much better. Some
general refactoring in operator resolution.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94498 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 03:27:55 +00:00
Douglas Gregor e69517ce61 Introduce clang_getInstantiationLocationOffset(), which decomposes a
source location in file + offset.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94497 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 03:07:15 +00:00
Daniel Dunbar 816bc31ed4 Driver/Darwin: Honor IPHONEOS_DEPLOYMENT_TARGET.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94488 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 01:45:19 +00:00
John McCall 7a6ae743b2 Warn on top-level 'asm volatile' (instead of misparsing it).
"Fixes" rdar://problem/7574870



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 22:27:48 +00:00
Ted Kremenek 6b67630d5d Move BugReporter.h, PathDiagnostic.h, and BugType.h to 'include/Checker/BugReporter'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 17:10:22 +00:00
Ted Kremenek 326be568e2 Add missing header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 05:19:37 +00:00
Ted Kremenek 1309f9a3b2 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 04:41:41 +00:00
Daniel Dunbar 3bd54cc562 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:44:02 +00:00
Daniel Dunbar fd9f23464b Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94393 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:43:14 +00:00
Anders Carlsson 7a6e13aa2e Fix a pretty bad bug where if a constructor (or conversion function) was marked as 'explicit', but then defined out-of-line, we would not treat it as being explicit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94366 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 17:15:04 +00:00
Anders Carlsson 0757c8ccb7 Implement [dcl.fct.spec]p6.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94365 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 16:49:46 +00:00
Mike Stump 8a8fa25bae Ok, turn back off -Wunreachable-code by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 16:16:01 +00:00
Sebastian Redl 8b00be5560 Mark PartialDiagnostic.h as a C++ header
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94363 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 10:02:25 +00:00
Anders Carlsson 703e394866 Implement instantiation of AsmStmts (Crazy, I know)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94361 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 05:50:09 +00:00
Daniel Dunbar a57259e9d7 Tweak clang_visitChildren comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:10:31 +00:00
Daniel Dunbar 1efcf3d137 Index.h: Tweak comments, delete trailing whitespace, fix a few typos, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94351 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 02:54:26 +00:00
Chris Lattner 7e52de4b45 fix PR6034, a crash on invalid where the switch stack would get
unbalanced.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 01:50:29 +00:00
Chris Lattner 31819f5383 add a prototype for __builtin_fpclassify. We don't know how to
codegen it, so we get 'cannot compile this builtin function yet'
errors, just like we do currently for __builtin_isinf.  However,
this should let us parse headers that use it without barfing,
which should help PR6083.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94346 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 01:30:04 +00:00
Anders Carlsson 1b36a2fcb2 Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94340 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 00:19:41 +00:00
Mike Stump b9ea98e6e5 Temporary flip default for -Wunreachable-code so some bots can test it
out.  They should all be done later tonight, but if something bad
happens, feel free to revert sooner.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 20:23:40 +00:00
Eli Friedman e6dddfd907 Add bzero builtin; this should help codegen quality for code using this
function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 19:00:10 +00:00
Anders Carlsson e87641915c Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94315 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 18:26:49 +00:00
Ted Kremenek 23e1ad09bb Add doxygen comment to clang_getClangVersion().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94311 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 17:51:23 +00:00
John McCall 258b203b85 Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).

The causes of this problem are different enough to justify a different "design"
for the diagnostic.  Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.

This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94303 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 08:10:49 +00:00
Anders Carlsson a729bbb739 Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 05:47:27 +00:00
David Chisnall 0d13f6fdbd Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 02:40:42 +00:00
Ted Kremenek a18f1b88a7 Rename getClangFullVendorVersion() to getClangFullVersion().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 02:11:34 +00:00
John McCall 92f883177b Implement elementary access control.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 00:46:32 +00:00
Douglas Gregor 4db64a461c Extend clang_createTranslationUnitFromSourceFile() to support creating
translation units that include unsaved files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 00:14:00 +00:00
Ted Kremenek 04bb716aea Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94242 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 22:44:15 +00:00
Ted Kremenek 3687a5d83f Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 22:29:50 +00:00
Douglas Gregor c42fefa51f Improve content and structure of the Doxygen documentation for the
CIndex API. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 22:29:16 +00:00
Ted Kremenek f7a96a3995 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 22:12:47 +00:00
Douglas Gregor b979034b10 Yet more CIndex API cleanup:
- Added more routines to manipulate/compare source locations and ranges
  - Switched clang_getCursor() over to take a CXSourceLocation rather
  than file/line/column.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 21:44:22 +00:00
Ted Kremenek 5b4ec63663 Rename pch::SVN_BRANCH_REVISION to pch::VERSION_CONTROL_BRANCH_REVISION.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 20:59:36 +00:00
Ted Kremenek 517e676b9e Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 20:55:35 +00:00
Douglas Gregor 33e9abd210 Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
  - Extend Preprocessor::getLocForEndOfToken() to accept an offset
  from the end, making it easy to move to the last character in the
  token (rather than just past the end of the token).
  - In Lexer::MeasureTokenLength(), the length of whitespace is zero.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 19:49:59 +00:00
Zhongxing Xu b79b117d3b Process cast according to the cast kind. Prepare for more specific cast
handling (for C++). No functionality change for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 04:30:00 +00:00
Daniel Dunbar eec99100f0 Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet. 

This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--

New invocation:
--
# For 10.6:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "t.o" "-lSystem"
# For 10.4:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.4" "-o" "a.out" "-lcrt1.o" "t.o" "-lSystem" "-lgcc_s.10.4" "/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1/lib/darwin/libclang_rt.10.4.a"
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94150 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 03:38:14 +00:00
Douglas Gregor 1ef2fc1888 Teach the cursor visitor to walk all of the C and Objective-C
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 00:50:27 +00:00
Chris Lattner f45b646244 revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 00:14:44 +00:00
John McCall 0380043d40 Due to local reversions and re-patching, I accidentally had multiple copies
of the 'payload' in this header.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 22:59:41 +00:00
Mike Stump 2d6ceab0ad Improve unreachable code warnings for with respect to dead functional casts in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 22:12:18 +00:00
Ted Kremenek 71842cc07a Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 19:22:34 +00:00
Fariborz Jahanian d8265b8383 Fixes a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 17:39:43 +00:00
Fariborz Jahanian d0502407c1 Patch to implement rewriting of properties.
Fixes radar 7562952.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 17:36:00 +00:00
Douglas Gregor 7d0d40e588 Introduce type references into the C API, capturing references to
typedefs only (for now).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 16:28:34 +00:00
Mike Stump 4c45aa1b00 Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls.  Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges.  All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 15:20:48 +00:00
Mike Stump b978a441c7 Add infrastructure to add base initializers and member initializers to
the CFG.  WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 02:21:40 +00:00
Douglas Gregor b2cd487561 Stash a CXXUnit pointer into each cursor. This allows us to simplify
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 23:57:43 +00:00
Douglas Gregor f55254472e Yet more Doxygen-comment tweaking in the CIndex library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:45:41 +00:00
Douglas Gregor 7f17376e09 Improve Doxygen documentation for the CIndex library, somewhat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:28:27 +00:00
John McCall 7264fa161f Change LLVM/clang #includes to use quotes, not angle-brackets. Just a think-o
prompted by the #include <iterator> above.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:16:29 +00:00
Douglas Gregor 04d1dd476a Kill CXEntity and CXDecl. The first has never been used, while the
second has been wholly replaced by cursors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:14:22 +00:00
John McCall 46460a68f6 First pass at collecting access-specifier information along inheritance paths.
Triggers lots of assertions about missing access information;  fix them.

Will actually consume this information soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:53:11 +00:00
Douglas Gregor 78205d4bad Kill some CXDecl-related APIs that have been superceded by
CXCursor-based APIs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:45:58 +00:00
Douglas Gregor 68372aa4c5 Kill CXStmt. It isn't being used anywhere, and has no future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:38:07 +00:00
Douglas Gregor 002a528ab0 Kill clang_loadDeclaration() and clang_loadTranslationUnit().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:37:00 +00:00
Daniel Dunbar d31351288e Use sizeof() instead of hard-coding a size for WrittenBuiltinSpecs, eek!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:13:31 +00:00
Douglas Gregor b1373d03e4 Introduce a new, cursor-based traversal function that visits the
children of a given cursor, regardless of what kind of cursor it
is. This is a generalization of clang_loadDeclaration and
clang_loadTranslationUnit that will also extent to statements,
expressions, etc.

As proof-of-concept, switched clang_loadDeclaration() from its own
visitor over to an instance of this traversal function internally.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 20:59:29 +00:00
Fariborz Jahanian 3ad230eb62 Settled rule on warning on unimplemented property in
category implementation when some implementations
are missing in the primary class implementation.
(fixes radar 6505200).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94014 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 19:36:21 +00:00
Chris Lattner 3ea5cf8889 reduce redundant are's
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94009 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 17:53:58 +00:00
Chandler Carruth fb26025575 Fix a typo pointed about by gabor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 07:43:54 +00:00
Chandler Carruth 103b71c37a Move the MacroBuilder utilitiy to its own header. Update references.
Comments and/or improvements to the documentation are welcome.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:13:02 +00:00
Chandler Carruth 8a32907d54 Fix a layering issue between Basic and FE by moving a utility class into Basic.
This isn't entirely satisfactory, as it seems an implementation detail, and
with nothing to do with TargetInfo. Suggestions on where to put this are
welcome.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 03:59:11 +00:00
Daniel Dunbar 225c41706d Driver: Lift clang resource directory computation to the Driver object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 02:35:16 +00:00
John McCall b377c98af6 Make UnresolvedSet.h standalone.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 01:36:13 +00:00
Douglas Gregor 20d416c36b Attempt to improve CIndex Doxygen organization, although I can't actually test this locally
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93961 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 01:10:47 +00:00
John McCall eec51cf1ba Give UnresolvedSet the ability to store access specifiers for each declaration.
Change LookupResult to use UnresolvedSet.  Also extract UnresolvedSet into its
own header and make it templated over an inline capacity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:46:10 +00:00
Douglas Gregor e0356b1083 Kill off clang_getDeclColumn, clang_getDeclExtent, clang_getDeclLine,
clang_getDeclSource, and clang_getDeclSourceFile; the cursor
equivalents are the way of the future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:26:57 +00:00
Douglas Gregor 7eaa8ae869 Introduce a special cursor kind for the translation unit, to serve as
the root of the conceptual cursor hierarchy (just like we do with
declarations). This will be used when we get to unify
clang_loadTranslationUnit() and clang_loadDeclaration() into something
more generally useful.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:23:15 +00:00
Douglas Gregor 36103f4d8b CXCursor_UnexposedDecl to the first declaration kind
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:07:45 +00:00
Douglas Gregor e0ca4baa1d Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,
and CXCursor_EnumConstantRef; they've been subsumed by expression
references, which do a much nicer job.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 23:25:01 +00:00
Douglas Gregor 97b9872d57 Extend the CIndex API with direct support for expressions and
statements, moving some of the more unnatural kinds of references
(VarRef, EnumConstantRef, etc.) over to the expressions. We can now
poke at arbitrary expressions and statements with, e.g.,
clang_getCursor() and get back useful information (e.g., source
ranges).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 23:20:36 +00:00
Mike Stump a3899eb5e3 Implement goto inside of blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 23:08:01 +00:00
John McCall 1d7d8d66ef The type of a compound literal expression is not necessarily the same as the
type which was syntactically written.  Fixes PR 6080.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:33:45 +00:00
Douglas Gregor e8c7043f6c Kill the unused and unnecessary CXCursor_MemberRef, twin to the
now-dead CXCursor_ObjCIvarRef.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:15:34 +00:00
Douglas Gregor 5a5ec3a318 Kill CXCursor_ObjCIvarRef. Such cursors could never be created, and
have been marked for death for a while.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:11:32 +00:00
Douglas Gregor 301221313b Introduce the notion of an "unexposed" declaration into the CIndex
API. This is a catch-all for any declaration known to Clang but not
specifically part of the CIndex API. We'll use the same approach with
expressions, statements, references, etc., as needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:07:56 +00:00
Mike Stump 079bd72439 Add CFG support for the start and end of scopes and infrastructure for
implicit destructor calls.  WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:00:14 +00:00