Commit Graph

2064 Commits

Author SHA1 Message Date
Ted Kremenek 2d6d886d73 Sort exports list.
llvm-svn: 146286
2011-12-09 22:28:29 +00:00
Argyrios Kyrtzidis 4996f5fba2 Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!
llvm-svn: 146213
2011-12-09 00:31:40 +00:00
Argyrios Kyrtzidis fa469d0efd [libclang] Make sure we don't try to handle a CXCursor_NoDeclFound
passed to clang_findReferencesInFile.

llvm-svn: 146211
2011-12-09 00:17:49 +00:00
Eli Friedman 83de51301a Misc Minix-specific changes to clang:
. move compiler-rt to a separate directory so the -L argument only includes compiler-rt (thanks joerg)
. build all clang subdirs
. switches the Minix platform to ELF
. normalizes toolchain invocation

Patch by Ben Gras.

llvm-svn: 146206
2011-12-08 23:54:21 +00:00
Argyrios Kyrtzidis 831411f42b [libclang] When doing clang_findReferencesInFile, make sure we don't crash
if we come up against a null Decl.

No test case unfortunately. rdar://10457799.

llvm-svn: 146127
2011-12-08 01:56:07 +00:00
Argyrios Kyrtzidis bf1d884d9e [libclang] Remove IndexingContext's getScopedContext(), it's not useful
now that client containers can be set via function calls.

llvm-svn: 146117
2011-12-08 00:54:07 +00:00
Argyrios Kyrtzidis 663c8ecda1 [libclang] Indexing API: provide both the semantic and the lexical container.
They are generally the same except in C++ cases like out-of-line member functions.

llvm-svn: 146069
2011-12-07 20:44:19 +00:00
Argyrios Kyrtzidis b3c16bad20 [libclang] Fix indexing of C++ bases in a C++ class.
llvm-svn: 146068
2011-12-07 20:44:15 +00:00
Argyrios Kyrtzidis 520028802c [libclang] Introduce CXIdxEntityLanguage that indicates the language
of an indexed entity.

llvm-svn: 146067
2011-12-07 20:44:12 +00:00
Argyrios Kyrtzidis 2b0b43cf56 [libclang] Index C++ namespaces.
llvm-svn: 146019
2011-12-07 05:52:06 +00:00
Ted Kremenek 9c9e81085f Tweak serialized diagnostics to support errors with no categories. Fixes <rdar://problem/10538300>.
llvm-svn: 146011
2011-12-07 02:08:00 +00:00
Argyrios Kyrtzidis 66f433a746 [libclang] API enhancements by Joe Groff!
- Exposes a CXType_Vector type kind for vector types.
- Adds generalized versions of the clang_getArrayElementType and clang_getArraySize functions, named clang_getElementType and clang_getNumElements, which work on array, vector, or complex types.
- Adds additional functions for querying function types. clang_isFunctionTypeVariadic returns true if a function type is variadic. clang_getFunctionCallingConv returns an enumeration value indicating the calling convention of the function type. clang_getNumArgTypes returns the number of static argument types, and clang_getArgType gets the type of an argument.
- Adds a clang_getTypedefDeclUnderlyingType function to get the underlying type from a TypedefDecl cursor.
- Adds a clang_getEnumDeclIntegerType function to get the integer type from an EnumDecl cursor.
- Adds clang_getEnumConstantDeclValue and clang_getEnumConstantDeclUnsignedValue functions to get the value of an EnumConstantDecl as a signed or unsigned long long, respectively.
- Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label") attributes.
- Alters clang_getCursorSpelling to return the label value for AsmLabelAttr-kind cursors.

llvm-svn: 145972
2011-12-06 22:05:01 +00:00
Argyrios Kyrtzidis 1a10f29b2f [libclang] When indexing a field in a C++ class, return an entity
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.

llvm-svn: 145859
2011-12-05 22:05:28 +00:00
Argyrios Kyrtzidis 0042b6f925 [libclang] Fix infinite loop when doing visitation of an OpaqueValueExpr.
llvm-svn: 145751
2011-12-03 03:49:47 +00:00
Argyrios Kyrtzidis 0fd8fae0a6 [libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.
llvm-svn: 145750
2011-12-03 03:49:44 +00:00
Douglas Gregor ba34552e79 Introduce a module import declaration, so that we properly represent, e.g.,
__import_module__ std.vector;

in the AST.

llvm-svn: 145725
2011-12-02 23:23:56 +00:00
Argyrios Kyrtzidis f2d99b0d38 [libclang] Create a diagnostic set to pass at the end of indexing.
llvm-svn: 145557
2011-12-01 02:42:50 +00:00
Argyrios Kyrtzidis ebbb20628a [libclang] Do the ConcurrencyCheck at the beginning of clang_findReferencesInFile.
llvm-svn: 145455
2011-11-29 23:21:50 +00:00
Benjamin Kramer 7f107eeea5 Preserve constness.
llvm-svn: 145397
2011-11-29 12:31:20 +00:00
Benjamin Kramer 696894a35b Silence GCC warnings, RefCountedBase is meant to be default-initialized here.
llvm-svn: 145396
2011-11-29 11:31:35 +00:00
Argyrios Kyrtzidis 6e210232ab [libclang] Fix leak in clang_indexSourceFile_Impl
llvm-svn: 145393
2011-11-29 08:14:50 +00:00
Argyrios Kyrtzidis 1ddb97ec86 [libclang] Make clang_findReferencesInFile also work on macros (find all expansions/definition
of a macro in a file).

As a bonus, also make searching for declarations more efficient by ignoring
preprocessing entities when we know that we are looking for a declaration.

Fixes rdar://10427411.

llvm-svn: 145369
2011-11-29 03:14:11 +00:00
Ted Kremenek 6cdff0a82b Fix serialized diagnostics to handle FixIts that only remove text. Fixes <rdar://problem/10473903>.
llvm-svn: 145339
2011-11-29 00:30:52 +00:00
Argyrios Kyrtzidis a3ec8e82c8 [libclang] Protect against the declaration's SourceRange being invalid
before passing to RangeCompare.

Though no idea how this can occur with the decls returned from
findFileRegionDecls().

llvm-svn: 145301
2011-11-28 22:38:07 +00:00
Bob Wilson bd0fbe86c5 Install c-index-test and clang-c/Index.h as internal files. rdar://10217046
Specify that these files should be installed to the optional internal
install location as specified by configure's --with-internal-prefix.
If that option is not used, they'll be installed to the default prefix
as before.

llvm-svn: 145235
2011-11-28 08:03:54 +00:00
Argyrios Kyrtzidis b11f5a4cbb [libclang] Indexing API: If the client requested to get a CXTranslationUnit after
indexing, honor all the TU options.

llvm-svn: 145229
2011-11-28 04:56:00 +00:00
Argyrios Kyrtzidis 67aa7db0a4 [libclang] Indexing API: Capture diagnostics during indexing.
llvm-svn: 145228
2011-11-28 04:55:55 +00:00
Argyrios Kyrtzidis 8ad3bab505 [libclang] Fix operations (token annotation, getting cursor, etc.) with a file region
inside an objc container that "contains" other file-level declarations.

When getting the array of file-level declarations that overlap with a file region,
we failed to report that the region overlaps with an objc container, if
the container had other file-level declarations declared lexically inside it.

Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST
and handling them appropriately.

llvm-svn: 145109
2011-11-23 20:27:36 +00:00
Argyrios Kyrtzidis 41fc05cad8 [libclang] Indexing API: Fix issues, mostly C++ related.
llvm-svn: 145107
2011-11-23 20:27:26 +00:00
Argyrios Kyrtzidis 4c910b1475 [libclang] Indexing API: Support C++ symbols.
llvm-svn: 145058
2011-11-22 07:24:51 +00:00
Peter Collingbourne 17a7bbbc9f Create the clang++ symlink as a POST_BUILD custom command on clang.
This saves us from re-creating the symlink on every build even if we
didn't rebuild clang.

llvm-svn: 145017
2011-11-21 00:00:48 +00:00
NAKAMURA Takumi 2a4859aeff c-index-test.c: Fix syntax according to C.
llvm-svn: 144947
2011-11-18 00:51:03 +00:00
Argyrios Kyrtzidis 841dd8861a Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

llvm-svn: 144943
2011-11-18 00:26:59 +00:00
Argyrios Kyrtzidis effdbf55ac [libclang] Indexing API:
-For indexDeclaration, also pass the declaration attributes as an array of cursors.
-Rename CXIndexOpt_OneRefPerFile -> CXIndexOpt_SuppressRedundantRefs, and only pass
  a reference if a declaration/definition does not exist in the file.
-Other fixes.

llvm-svn: 144942
2011-11-18 00:26:51 +00:00
Argyrios Kyrtzidis 1cff795e51 [libclang] Indexing API: make sure we don't pass declarations/references without USR or location.
llvm-svn: 144941
2011-11-18 00:26:46 +00:00
Ted Kremenek 8cf47df72f Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase<T> has
a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation
objects created by ASTUnit were actually leaked.  When I fixed that bug locally, it showed that a whole bunch of code assumed
that the LangOptions object that was part of CompilerInvocation was still alive.  By making it heap-allocated and reference counted,
we can keep it around after the CompilerInvocation object goes away.

As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this
object may outlive the CompilerInvocation object.

This commit doesn't fix the CompilerInvocation leak itself.  That will come when I commit the fix to llvm::RefCountedBase<T> to
mainline LLVM.

llvm-svn: 144930
2011-11-17 23:01:24 +00:00
Argyrios Kyrtzidis 7ae5d9c4c0 [libclang] Add a comment in lazyCreateDiags to explain why the check and reset of
diagnostic set is necessary.

llvm-svn: 144793
2011-11-16 08:59:00 +00:00
Argyrios Kyrtzidis 463741a5a2 [libclang] Make clang_annotateTokens use "file-targeted" deserialization and avoid
unnecessary deserializations.

llvm-svn: 144792
2011-11-16 08:58:57 +00:00
Argyrios Kyrtzidis c504eb3448 [libclang] Make clang_findReferencesInFile use "file-targeted" deserialization and avoid
unnecessary deserializations.

llvm-svn: 144791
2011-11-16 08:58:54 +00:00
Ted Kremenek 0e9843b328 Teach ccc-analyzer about -fobjc-arc.
llvm-svn: 144778
2011-11-16 05:14:42 +00:00
Argyrios Kyrtzidis df15c20979 [libclang] Indexing API: fill the objc category info for a category implementation and
do not crash if no client container is registered for a declaration context.

llvm-svn: 144765
2011-11-16 02:35:05 +00:00
Argyrios Kyrtzidis d7b8790003 [libclang] Indexing API: make sure we do not try to index local declarations.
llvm-svn: 144764
2011-11-16 02:35:01 +00:00
Argyrios Kyrtzidis e4acd23f0b [libclang] Indexing API: if the CXIndexOpt_OneRefPerFile option is set, only report one reference
per file.

llvm-svn: 144763
2011-11-16 02:34:59 +00:00
Argyrios Kyrtzidis f03e734876 [libclang] In lazyCreateDiags, recreate the diagnostic set if the number of diagnostics
in the ASTUnit changed.

llvm-svn: 144762
2011-11-16 02:34:55 +00:00
Argyrios Kyrtzidis 233f12d9e2 [libclang] Indexing API: Pass an implicit ObjCInterfaceDecl (@implementation without @interface)
in a separate indexing callback than its implementation.

llvm-svn: 144625
2011-11-15 06:20:24 +00:00
Argyrios Kyrtzidis d992e14394 [libclang] Introduce a new function to apply the indexing callbacks on an existing
CXTranslationUnit, mainly to be used for indexing a PCH.

llvm-svn: 144623
2011-11-15 06:20:16 +00:00
Ted Kremenek ec9b50d961 Fix potential memory leak for clients of clang_getOverriddenCursors(). If the number of overriden cursors is 0, do not allocate an array of CXCursors. This fixes a memory leak in c-index-test, and clients who use this API in a similar way.
llvm-svn: 144595
2011-11-14 23:51:37 +00:00
Argyrios Kyrtzidis 86acd72bd2 [libclang] Slight changes to the indexing API and bigger internal changes for it.
llvm-svn: 144577
2011-11-14 22:39:19 +00:00
Argyrios Kyrtzidis 70480496c8 [libclang] Move the check for errors in c-index-test before the TU gets disposed.
llvm-svn: 144514
2011-11-13 23:39:14 +00:00
Argyrios Kyrtzidis e74e8222ee [libclang] for c-index-test, check for CINDEXTEST_FAILONERROR when doing -test-load-source-reparse
llvm-svn: 144509
2011-11-13 22:08:33 +00:00
Argyrios Kyrtzidis 3e429e7cc4 [libclang] Further simplify the indexing API.
That stuff can be added later on if we need them.
Also add some const goodness.

llvm-svn: 144446
2011-11-12 02:16:30 +00:00
Ted Kremenek 70394cf76c Tweak CXLoadedDiagnosticSetImpl::makeString() to include an extra null character, and change the creation of the FixIT's string to again just rely on this string (instead of duplicating it when calling createCXString).
llvm-svn: 144389
2011-11-11 15:19:48 +00:00
Benjamin Kramer b9af5f6eff Silence compiler warning.
llvm-svn: 144386
2011-11-11 14:13:03 +00:00
NAKAMURA Takumi e89c3bd004 libclang/CXLoadedDiagnostic.cpp: Work around not to miss the string terminator on fixit.
FixIts might be exposed as C string via clang_getCString(), though the zero terminator is not allocated in CXLoadedDiagnosticSetImpl::makeString.

llvm-svn: 144379
2011-11-11 07:27:33 +00:00
Ted Kremenek a0e32fc8b6 [serialized diagnostics]: add test cases for serialized diagnostics, including a test case for no issues, multiple issues, and
a single issue.  Along the way, tweak c-index-test -read-diagnostics output so it is easier to tell what diagnostics are
child diagnostics.

llvm-svn: 144349
2011-11-11 00:46:43 +00:00
Argyrios Kyrtzidis 7519c5e440 [libclang] Simplify the indexing API.
Cut down the number of callbacks to more generic ones. Clients can check
an enum to find out what kind of declaration it is and they can call functions
to get more specific information than the generic provided info.

llvm-svn: 144343
2011-11-11 00:23:36 +00:00
NAKAMURA Takumi 27dd3964ac c-index-test.c: Fix a comment style. /* It is C source. */
llvm-svn: 144274
2011-11-10 10:07:57 +00:00
NAKAMURA Takumi 77d9739249 c-index-test.c: Fix syntax. It is C source.
llvm-svn: 144272
2011-11-10 09:30:15 +00:00
Ted Kremenek d010ba4729 serialized diagnostics: implement full deserialization of clang diagnostics via the libclang API.
I've tested it on simple cases and it works.  Test cases to follow as well as a few tweaks.

llvm-svn: 144269
2011-11-10 08:43:12 +00:00
Ted Kremenek da3cfc9fef Sort contents of exports file. No functionality change.
llvm-svn: 144116
2011-11-08 20:42:13 +00:00
Anna Zaks 9fed084503 [analyzer] Make sure scan-build catches all clang failures.
scan-build ignores clang failures in some cases, which might lead to
silent failure suppression. For example, if clang command line
argument is wrong. (Addresses radar://10406598)

llvm-svn: 144029
2011-11-07 22:38:10 +00:00
John McCall fe96e0b6be Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions.  It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST.  I've gone ahead and simplified the
ObjC rewriter's use of properties;  other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily.  Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.

llvm-svn: 143867
2011-11-06 09:01:30 +00:00
Argyrios Kyrtzidis 8c25804ce1 [libclang] For "c-index-test -index-file", print out the names of the callbacks.
llvm-svn: 143779
2011-11-05 04:03:35 +00:00
Argyrios Kyrtzidis d208ef95aa [arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.
llvm-svn: 143698
2011-11-04 15:58:08 +00:00
Argyrios Kyrtzidis 52d87a6f82 [libclang] Move CursorVisitor to its own header.
llvm-svn: 143639
2011-11-03 19:02:34 +00:00
Argyrios Kyrtzidis 3cefc9d742 [libclang] Use CursorVisitor::Visit instead of invoking the visitor directly.
llvm-svn: 143637
2011-11-03 19:02:28 +00:00
Argyrios Kyrtzidis 7ca77357ce [libclang] Add missing return in clang_getExpansionLocation that resulted in that function
always returning a null file/line/column.

Also add at least one use of clang_getExpansionLocation inside c-index-test that would have
made the tests to catch that.

llvm-svn: 143606
2011-11-03 02:20:36 +00:00
Argyrios Kyrtzidis e968152564 [libclang] Add infrastructure to be able to only deserialize decls in a file region and
use it for clang_getCursor.

llvm-svn: 143605
2011-11-03 02:20:32 +00:00
Argyrios Kyrtzidis cb373e3f31 [libclang] For c-index-test disable caching of code completion results if
the CINDEXTEST_COMPLETION_NO_CACHING environment variable is present.

llvm-svn: 143604
2011-11-03 02:20:25 +00:00
Eli Friedman 61108f2378 Add missing export. Spotted by Leandro Melo.
llvm-svn: 143508
2011-11-01 22:25:07 +00:00
Sebastian Pop 8188c8a1f3 rename getHostTriple into getDefaultTargetTriple in clang
llvm-svn: 143503
2011-11-01 21:33:06 +00:00
Argyrios Kyrtzidis b9689bb46f [libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.

This follows what we already did for objc methods. rdar://10371669

llvm-svn: 143464
2011-11-01 17:14:12 +00:00
Tobias Grosser 1a5307c7cc Add LinkAllPasses to clang
This patch ensures that no passes are deleted from clang, such that the loading
of plugins does not fail because of passes being unavailable.  This increases
the size of the clang binary from 43029853 to 43915291 bytes (around 2%).

llvm-svn: 143414
2011-11-01 01:34:59 +00:00
Douglas Gregor d73f3ddb44 Rework the AST for the initializer of a delegating constructor, so
that it retains source location information for the type. Aside from
general goodness (being able to walk the types described in that
information), we now have a proper representation for dependent
delegating constructors. Fixes PR10457 (for real).

llvm-svn: 143410
2011-11-01 01:16:03 +00:00
Ted Kremenek ce6a5718ce [libclang] Tweak internals of CXSourceLocation to allow an alternate implementation if the lowest bit of ptr_data[0] is not 0. This
is prep for work on serialized diagnostics.

llvm-svn: 143373
2011-10-31 22:23:51 +00:00
Ted Kremenek 4c4f08d555 [libclang] Move implementation of functions for manipulation CXSourceLocations and CXSourceRanges into a separate file.
llvm-svn: 143370
2011-10-31 22:05:42 +00:00
Ted Kremenek bb2c7101b5 [libclang] Add CXDiagnosticImpl to represent a super class for the implementation backing a CXDiagnostic. This allows CXStoredDiagnostic
to be just one possible implementation of a CXDiagnostic.

llvm-svn: 143368
2011-10-31 21:40:19 +00:00
Argyrios Kyrtzidis f3068a73f7 [libclang] Rename VisitIncludedPreprocessingEntries -> VisitIncludedEntities
llvm-svn: 143337
2011-10-31 07:19:54 +00:00
Peter Collingbourne f1d76db466 Add support for lazily linking bitcode files (using a new
-mlink-bitcode-file flag), and more generally llvm::Modules, before
running optimisations.

llvm-svn: 143314
2011-10-30 17:30:44 +00:00
Argyrios Kyrtzidis 9780553ef0 Use LIBCLANG_NOTHREADS instead of CINDEXTEST_NOTHREADS inside libclang,
so the c-index-test one can be enabled without affecting libclang.

llvm-svn: 143288
2011-10-29 19:32:39 +00:00
Argyrios Kyrtzidis a109e00bba [libclang] Introduce use of CINDEXTEST_FAILONERROR environment variable which, if set,
will cause c-index-test to return as failed if a compiler error occurred.

llvm-svn: 143243
2011-10-28 22:54:36 +00:00
Argyrios Kyrtzidis d92ced00b1 [libclang] Check for environment variable CINDEXTEST_NOTHREADS in clang_reparseTranslationUnit.
llvm-svn: 143242
2011-10-28 22:54:33 +00:00
Benjamin Kramer f1b4e0052f Use const_cast to make it obvious that it's just removing constness (and silence warnings).
llvm-svn: 143193
2011-10-28 13:37:11 +00:00
Douglas Gregor deb4a2be67 Implement support for dependent Microsoft __if_exists/__if_not_exists
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".

llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Argyrios Kyrtzidis 429ec024f8 [PCH] When visiting preprocessed entities, make it possible to avoid deserializing
preprocessed entities that are #included in the range that we are interested.

This is useful when we are interested in preprocessed entities of a specific file, e.g
when we are annotating tokens. There is also an optimization where we cache the last
result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if
there is a call with the same range as before.

rdar://10313365

llvm-svn: 142887
2011-10-25 00:29:50 +00:00
Benjamin Kramer 42d0cbd76e Reduce dependencies.
llvm-svn: 142742
2011-10-23 08:38:37 +00:00
Argyrios Kyrtzidis 9006807dcd [libclang] Don't use C++-style comments in c-index-test.c.
llvm-svn: 142590
2011-10-20 17:21:46 +00:00
John McCall 59207978e6 More metaprogramming with builtin types.
llvm-svn: 142433
2011-10-18 22:28:37 +00:00
Argyrios Kyrtzidis 72a3cf0a4a [libclang] Make sure we do a correct invalid check in clang_getExpansionLocation.
llvm-svn: 142430
2011-10-18 21:59:54 +00:00
John McCall e314e27c58 Macro metaprogramming for builtin types.
llvm-svn: 142420
2011-10-18 21:02:43 +00:00
Argyrios Kyrtzidis 098c4eabd2 [libclang] Since an objc extension semantically continues the interface of the class
don't use unique USRs for them, otherwise we fail to associate @implementation methods
with the methods in extensions.

llvm-svn: 142361
2011-10-18 16:50:06 +00:00
Argyrios Kyrtzidis 0c7735e525 [libclang] Index implicit property references.
llvm-svn: 142355
2011-10-18 15:50:50 +00:00
Argyrios Kyrtzidis 1c7dcd04b8 [libclang] When printing the diagnostic print it with a new line.
llvm-svn: 142354
2011-10-18 15:13:14 +00:00
Argyrios Kyrtzidis 321e30216a [libclang] Index method references.
llvm-svn: 142353
2011-10-18 15:13:11 +00:00
Nick Lewycky 1d617acef9 Wire up support for the controlling the extended dwarf .file directive. With
r142300 but not this patch, clang -S may emit .s files that assemblers other
than llvm-mc can't parse.

llvm-svn: 142301
2011-10-17 23:05:52 +00:00
Matt Beaumont-Gay cb6e5c16ef Silence a -Wc++0x-narrowing warning
llvm-svn: 142292
2011-10-17 22:19:09 +00:00
Argyrios Kyrtzidis 317ebfe18e Try fixing MSVC compiler errors.
llvm-svn: 142289
2011-10-17 22:12:24 +00:00
Argyrios Kyrtzidis dc199a3152 [libclang] Introduce a new high level API for indexing clients that assumes
more of the work involved in indexing a translation unit and simplifies client
implementations.

Only C/ObjC for now, C++ (and comments) to come.

llvm-svn: 142233
2011-10-17 19:48:19 +00:00
John McCall 8a6b59ad97 Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

llvm-svn: 142208
2011-10-17 18:09:15 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Benjamin Kramer b89514a9b8 Change operator<< for raw_ostream and NamedDecl to take a reference instead of a pointer.
Passing a pointer was a bad idea as it collides with the overload for void*.

llvm-svn: 141971
2011-10-14 18:45:37 +00:00
Erik Verbruggen 98ea7f6737 Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations to
retrieve annotations from completion string.

llvm-svn: 141953
2011-10-14 15:31:08 +00:00
Erik Verbruggen ca98f2a63f Allow for annotate attributes after access specifiers. When such
attributes are found, propagate them to subsequent declarations.

llvm-svn: 141861
2011-10-13 09:41:32 +00:00
Argyrios Kyrtzidis e454986617 [libclang] Allow using getDeclCursorUSR function with a Decl* and not a cursor.
llvm-svn: 141770
2011-10-12 07:07:36 +00:00
Argyrios Kyrtzidis 769c7bcd9a [libclang] Make MakeCXTranslationUnit usable outside CIndex.cpp.
llvm-svn: 141769
2011-10-12 07:07:33 +00:00
Eli Friedman df14b3a837 Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
Douglas Gregor e442fe3db9 Make sure we initialize the "extra" data within the libclang code
completion context, in case we end up having no code-completion
callback. Individual instances of this problem are always bugs that
need to be fixed, but it's better to make sure we have initialized
data here.

llvm-svn: 141598
2011-10-10 23:37:54 +00:00
Argyrios Kyrtzidis ffd530f2c0 [libclang] Do ConcurrencyCheck for clang_getLocation as well.
llvm-svn: 141583
2011-10-10 21:57:15 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Erik Verbruggen 338b55cc73 Fixed GCC (C90) and Clang warnings.
llvm-svn: 141281
2011-10-06 11:38:08 +00:00
Erik Verbruggen 2e657ffd8e Added CXAvailability_NotAccessible to indicate that a declaration is available, but not accessible from the current code completion context.
llvm-svn: 141278
2011-10-06 07:27:49 +00:00
Argyrios Kyrtzidis cddafd3969 [libclang] Introduce clang_findReferencesInFile which accepts a cursor, a file,
and a callback and finds all identifier references of the cursor in the file.

rdar://7948304

llvm-svn: 141277
2011-10-06 07:00:54 +00:00
Argyrios Kyrtzidis 3b947f72da [libclang] Move the bulk of clang_getOverriddenCursors into
a cxcursor::getOverriddenCursors C++ function, because SmallVectors
are groovier that malloc'ing buffers.

llvm-svn: 141276
2011-10-06 07:00:46 +00:00
Douglas Gregor 4c362d5310 Expose more statement, expression, and declaration kinds in libclang,
from Manuel Holtgrewe!

llvm-svn: 141200
2011-10-05 19:00:14 +00:00
Bob Wilson 05de0298d2 Rip out flags for controlling C++ "production mode" separately.
This is old leftover cruft from the days when C++ was not yet ready
for prime time.

llvm-svn: 141063
2011-10-04 05:34:14 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Argyrios Kyrtzidis 12afd70370 [libclang] Introduce CXCursor_CXXAccessSpecifier for C++'s public:/private:/protected: specifiers.
Patch by Paolo Capriotti!

llvm-svn: 140864
2011-09-30 17:58:23 +00:00
Argyrios Kyrtzidis e7e4291448 [libclang] Introduce clang_Range_isNull.
llvm-svn: 140706
2011-09-28 18:14:21 +00:00
NAKAMURA Takumi 37a4674fdc Install c-index-test also on CMake build, following up r140681.
llvm-svn: 140694
2011-09-28 10:50:23 +00:00
Ted Kremenek 7f01c7b5f1 Install c-index-test as part of install-clang-c Makefile rule.
llvm-svn: 140681
2011-09-28 04:39:41 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
Argyrios Kyrtzidis 2b0cf60df3 [libclang] Expose array size and element type, patch by Vinay Sajip!
llvm-svn: 140614
2011-09-27 17:44:34 +00:00
Argyrios Kyrtzidis a1bcb6adb5 MSVC is stuck in the 80s.
llvm-svn: 140597
2011-09-27 04:14:36 +00:00
Argyrios Kyrtzidis fd51520d5f [libclang] Refactor the important stuff in clang_getCursor into a cxcursor::getCursor(CXTranslationUnit, SourceLocation) function.
llvm-svn: 140588
2011-09-27 00:30:33 +00:00
Argyrios Kyrtzidis d6e9fa55eb [libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit functions.
llvm-svn: 140587
2011-09-27 00:30:30 +00:00
Argyrios Kyrtzidis a4fa0d8be7 [libclang] Report implicit objc methods for properties when indexing.
Related to rdar://10087069.

llvm-svn: 140551
2011-09-26 19:05:37 +00:00
Argyrios Kyrtzidis 4cdfcae75d Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble.

Instead, handle specially locations of preprocessed entities:
-When looking up for preprocessed entities, map main file locations inside the
 preamble range to a preamble loaded location.
-When getting the source range of a preprocessing cursor, map preamble loaded
 locations back to main file locations.

Fixes rdar://10175093 & http://llvm.org/PR10999

llvm-svn: 140519
2011-09-26 08:01:41 +00:00
David Blaikie 69609dcead Rename VerifyDiagnosticsClient to VerifyDiagnosticConsumer as per issue 5397
llvm-svn: 140489
2011-09-26 00:38:03 +00:00
David Blaikie e2eefaecc8 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
llvm-svn: 140479
2011-09-25 23:39:51 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie aa347f9392 Removing a bunch of dead returns/breaks after llvm_unreachables.
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Argyrios Kyrtzidis de6aa08013 Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no functionality change.
llvm-svn: 140330
2011-09-22 20:07:03 +00:00
Argyrios Kyrtzidis 45e8cf5732 [libclang] When pointing at a macro expansion inside a macro argument,
return a cursor for the inner macro.

llvm-svn: 140207
2011-09-20 23:27:33 +00:00
Ted Kremenek 057b986d9d Sort exports list.
llvm-svn: 140171
2011-09-20 19:02:45 +00:00
Argyrios Kyrtzidis 5733271925 In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

llvm-svn: 140063
2011-09-19 20:40:48 +00:00
Argyrios Kyrtzidis 7c06d8666b [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

llvm-svn: 140060
2011-09-19 20:40:35 +00:00
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Erik Verbruggen 852725b615 First test commit.
llvm-svn: 140016
2011-09-19 15:03:11 +00:00
Argyrios Kyrtzidis 303e513544 [libclang] Remove libclang.darwin.exports, it's not used anymore.
llvm-svn: 139661
2011-09-13 23:12:36 +00:00
Argyrios Kyrtzidis 91672b3c03 [libclang] Introduce clang_getPresumedLocation which works like clang_getExpansionLocation
but takes into account #line directives coming from preprocessed files.

Patch by Vinay Sajip!

llvm-svn: 139647
2011-09-13 21:49:08 +00:00
Argyrios Kyrtzidis 4c2131a775 [libclang] Correct annotation and taking of cursor for objc class references
inside the IBOutletCollection attribute.

llvm-svn: 139621
2011-09-13 18:49:56 +00:00
Argyrios Kyrtzidis c179111536 Rename InterFace -> Interface, no functionality change.
llvm-svn: 139620
2011-09-13 18:49:52 +00:00
Argyrios Kyrtzidis 2cb4e3c554 [libclang]
-Allow cursor visitation of an attribute using its source range
-Add C++ 'final' and 'override' attributes as cursor kinds
-Simplify the logic that marks 'final' and 'override' attributes as tokens.

llvm-svn: 139609
2011-09-13 17:39:31 +00:00
Douglas Gregor 2b9b464290 When compiling a module on-demand, re-use the diagnostics client
already provided. This required a little bit of clean-up in the way
that VerifyDiagnosticsClient managed ownership of its underlying
"primary" client, because now it will no longer always take ownership.

llvm-svn: 139570
2011-09-13 01:26:44 +00:00
Argyrios Kyrtzidis 01e3c590ae [libclang] For getDeclFromExpr in CIndex.cpp, associate the decl of
a DeclRefExpr, MemberExpr, etc. with a CastExpr if it is ImplicitCast,
since the implicit cast is the one that is invisible in source code.

llvm-svn: 139547
2011-09-12 22:17:26 +00:00
Argyrios Kyrtzidis 3405baa3f0 [libclang] Make c-index-test check CINDEXTEST_REMAP_AFTER_TRIAL environment variable,
which when set it determines the trial number after which the remapping of files should
take effect.

llvm-svn: 139511
2011-09-12 18:09:31 +00:00
Douglas Gregor 98c05b286c Kill of the Decl::PCHLevel field entirely. We now only need to know
whether a Decl was deserialized from an AST file (any AST file).

llvm-svn: 139438
2011-09-10 00:09:20 +00:00
Douglas Gregor 1bbf030b8e The translation unit is never deserialized
llvm-svn: 139436
2011-09-09 23:34:14 +00:00