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

2072 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis c6b4a50995 [libclang] Indexing API: if the CXIndexOpt_OneRefPerFile option is set, only report one reference
per file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144763 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 02:34:59 +00:00
Argyrios Kyrtzidis 220b45c95e [libclang] In lazyCreateDiags, recreate the diagnostic set if the number of diagnostics
in the ASTUnit changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144762 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 02:34:55 +00:00
Argyrios Kyrtzidis e7bbab91f5 [libclang] Indexing API: Pass an implicit ObjCInterfaceDecl (@implementation without @interface)
in a separate indexing callback than its implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144625 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 06:20:24 +00:00
Argyrios Kyrtzidis 21ee5707e6 [libclang] Introduce a new function to apply the indexing callbacks on an existing
CXTranslationUnit, mainly to be used for indexing a PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144623 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 06:20:16 +00:00
Ted Kremenek 2407712d90 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 23:51:37 +00:00
Argyrios Kyrtzidis c71d55469e [libclang] Slight changes to the indexing API and bigger internal changes for it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144577 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 22:39:19 +00:00
Argyrios Kyrtzidis 16ac8be588 [libclang] Move the check for errors in c-index-test before the TU gets disposed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 23:39:14 +00:00
Argyrios Kyrtzidis bda536df1f [libclang] for c-index-test, check for CINDEXTEST_FAILONERROR when doing -test-load-source-reparse
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 22:08:33 +00:00
Argyrios Kyrtzidis 6ec43adc39 [libclang] Further simplify the indexing API.
That stuff can be added later on if we need them.
Also add some const goodness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144446 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 02:16:30 +00:00
Ted Kremenek e97ac9e684 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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144389 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 15:19:48 +00:00
Benjamin Kramer 8f6457e75d Silence compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 14:13:03 +00:00
NAKAMURA Takumi 40f6975af8 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 07:27:33 +00:00
Ted Kremenek a7e8a8394c [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 00:46:43 +00:00
Argyrios Kyrtzidis dd93c596cd [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 00:23:36 +00:00
NAKAMURA Takumi a4ca95a6eb c-index-test.c: Fix a comment style. /* It is C source. */
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144274 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 10:07:57 +00:00
NAKAMURA Takumi 9190943fef c-index-test.c: Fix syntax. It is C source.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 09:30:15 +00:00
Ted Kremenek 153221717e 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 08:43:12 +00:00
Ted Kremenek 4c11772bb9 Sort contents of exports file. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144116 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 20:42:13 +00:00
Anna Zaks 1a8a8cbea6 [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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144029 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 22:38:10 +00:00
John McCall 4b9c2d235f 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 09:01:30 +00:00
Argyrios Kyrtzidis 66042b32b3 [libclang] For "c-index-test -index-file", print out the names of the callbacks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 04:03:35 +00:00
Argyrios Kyrtzidis e0ac7454ba [arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143698 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 15:58:08 +00:00
Argyrios Kyrtzidis e397bf1bd9 [libclang] Move CursorVisitor to its own header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 19:02:34 +00:00
Argyrios Kyrtzidis ba98617b99 [libclang] Use CursorVisitor::Visit instead of invoking the visitor directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143637 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 19:02:28 +00:00
Argyrios Kyrtzidis b4efaa0a14 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143606 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 02:20:36 +00:00
Argyrios Kyrtzidis dfb332d008 [libclang] Add infrastructure to be able to only deserialize decls in a file region and
use it for clang_getCursor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 02:20:32 +00:00
Argyrios Kyrtzidis dcaca015a2 [libclang] For c-index-test disable caching of code completion results if
the CINDEXTEST_COMPLETION_NO_CACHING environment variable is present.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143604 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 02:20:25 +00:00
Eli Friedman d22718ca68 Add missing export. Spotted by Leandro Melo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143508 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 22:25:07 +00:00
Sebastian Pop 5d8b954842 rename getHostTriple into getDefaultTargetTriple in clang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:33:06 +00:00
Argyrios Kyrtzidis 87ec9c257c [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143464 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 17:14:12 +00:00
Tobias Grosser f358c8af7b 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%).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 01:34:59 +00:00
Douglas Gregor 76852c218a 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 01:16:03 +00:00
Ted Kremenek 51a7d5d7f6 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143373 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-31 22:23:51 +00:00
Ted Kremenek 3ddef060a9 [libclang] Move implementation of functions for manipulation CXSourceLocations and CXSourceRanges into a separate file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-31 22:05:42 +00:00
Ted Kremenek 1edabbc32a [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-31 21:40:19 +00:00
Argyrios Kyrtzidis e70984629f [libclang] Rename VisitIncludedPreprocessingEntries -> VisitIncludedEntities
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143337 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-31 07:19:54 +00:00
Peter Collingbourne 22a7dfea58 Add support for lazily linking bitcode files (using a new
-mlink-bitcode-file flag), and more generally llvm::Modules, before
running optimisations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-30 17:30:44 +00:00
Argyrios Kyrtzidis e7de9b4a1f Use LIBCLANG_NOTHREADS instead of CINDEXTEST_NOTHREADS inside libclang,
so the c-index-test one can be enabled without affecting libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-29 19:32:39 +00:00
Argyrios Kyrtzidis dfca64ddfb [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143243 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-28 22:54:36 +00:00
Argyrios Kyrtzidis 8c4b47eff0 [libclang] Check for environment variable CINDEXTEST_NOTHREADS in clang_reparseTranslationUnit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143242 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-28 22:54:33 +00:00
Benjamin Kramer 854625f734 Use const_cast to make it obvious that it's just removing constness (and silence warnings).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-28 13:37:11 +00:00
Douglas Gregor ba0513de93 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".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142901 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 01:33:02 +00:00
Argyrios Kyrtzidis f226ff9fe8 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142887 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 00:29:50 +00:00
Benjamin Kramer 59283a001c Reduce dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142742 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23 08:38:37 +00:00
Argyrios Kyrtzidis f89bc0500c [libclang] Don't use C++-style comments in c-index-test.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142590 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20 17:21:46 +00:00
John McCall 2dde35bc62 More metaprogramming with builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 22:28:37 +00:00
Argyrios Kyrtzidis c705d2520a [libclang] Make sure we do a correct invalid check in clang_getExpansionLocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 21:59:54 +00:00
John McCall e0a22d0688 Macro metaprogramming for builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142420 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 21:02:43 +00:00
Argyrios Kyrtzidis 46d1ea40d7 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142361 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 16:50:06 +00:00
Argyrios Kyrtzidis aca19be873 [libclang] Index implicit property references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142355 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 15:50:50 +00:00
Argyrios Kyrtzidis c0f5b754ea [libclang] When printing the diagnostic print it with a new line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142354 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 15:13:14 +00:00
Argyrios Kyrtzidis 9fbbf14af5 [libclang] Index method references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142353 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 15:13:11 +00:00
Nick Lewycky ea523d73a6 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:05:52 +00:00
Matt Beaumont-Gay 3de2fc4e42 Silence a -Wc++0x-narrowing warning
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 22:19:09 +00:00
Argyrios Kyrtzidis 36180f3c84 Try fixing MSVC compiler errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 22:12:24 +00:00
Argyrios Kyrtzidis 4e7064fa7e [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142233 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 19:48:19 +00:00
John McCall 0ddaeb9b03 Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142208 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 18:09:15 +00:00
Anton Korobeynikov aa4a99b4a6 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 23:23:15 +00:00
Benjamin Kramer b8989f27f1 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*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 18:45:37 +00:00
Erik Verbruggen 6164ea1d75 Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations to
retrieve annotations from completion string.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 15:31:08 +00:00
Erik Verbruggen 5f1c822def Allow for annotate attributes after access specifiers. When such
attributes are found, propagate them to subsequent declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 09:41:32 +00:00
Argyrios Kyrtzidis b6a4ac4135 [libclang] Allow using getDeclCursorUSR function with a Decl* and not a cursor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141770 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 07:07:36 +00:00
Argyrios Kyrtzidis 9049cf6cb4 [libclang] Make MakeCXTranslationUnit usable outside CIndex.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141769 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 07:07:33 +00:00
Eli Friedman 276b061970 Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141632 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 02:20:01 +00:00
Douglas Gregor b77d197a78 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141598 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 23:37:54 +00:00
Argyrios Kyrtzidis 57165bea7c [libclang] Do ConcurrencyCheck for clang_getLocation as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141583 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 21:57:15 +00:00
John McCall 5e1cdac63c Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141355 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 06:10:15 +00:00
Eli Friedman b001de7458 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!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 23:00:33 +00:00
Erik Verbruggen 26fc0f9a07 Fixed GCC (C90) and Clang warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 11:38:08 +00:00
Erik Verbruggen d12059673d Added CXAvailability_NotAccessible to indicate that a declaration is available, but not accessible from the current code completion context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141278 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 07:27:49 +00:00
Argyrios Kyrtzidis aed123ec3c [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141277 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 07:00:54 +00:00
Argyrios Kyrtzidis b11be041e4 [libclang] Move the bulk of clang_getOverriddenCursors into
a cxcursor::getOverriddenCursors C++ function, because SmallVectors
are groovier that malloc'ing buffers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 07:00:46 +00:00
Douglas Gregor 42b2984771 Expose more statement, expression, and declaration kinds in libclang,
from Manuel Holtgrewe!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141200 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-05 19:00:14 +00:00
Bob Wilson 10a82cde7c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 05:34:14 +00:00
Argyrios Kyrtzidis 1711fc91ef 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 '@'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141061 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 04:48:02 +00:00
Argyrios Kyrtzidis 2dfdb948be [libclang] Introduce CXCursor_CXXAccessSpecifier for C++'s public:/private:/protected: specifiers.
Patch by Paolo Capriotti!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140864 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-30 17:58:23 +00:00
Argyrios Kyrtzidis de5db649fd [libclang] Introduce clang_Range_isNull.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140706 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 18:14:21 +00:00
NAKAMURA Takumi b58404d18e Install c-index-test also on CMake build, following up r140681.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140694 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 10:50:23 +00:00
Ted Kremenek d1223d8654 Install c-index-test as part of install-clang-c Makefile rule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140681 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 04:39:41 +00:00
Douglas Gregor 30c4240420 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 22:38:19 +00:00
Argyrios Kyrtzidis 5f0bfc5222 [libclang] Expose array size and element type, patch by Vinay Sajip!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 17:44:34 +00:00
Argyrios Kyrtzidis fa865df489 MSVC is stuck in the 80s.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140597 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 04:14:36 +00:00
Argyrios Kyrtzidis 671436e9e2 [libclang] Refactor the important stuff in clang_getCursor into a cxcursor::getCursor(CXTranslationUnit, SourceLocation) function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140588 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 00:30:33 +00:00
Argyrios Kyrtzidis b0d6eaa6b6 [libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140587 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 00:30:30 +00:00
Argyrios Kyrtzidis 65ab90736e [libclang] Report implicit objc methods for properties when indexing.
Related to rdar://10087069.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26 19:05:37 +00:00
Argyrios Kyrtzidis ee0f84fc84 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26 08:01:41 +00:00
David Blaikie 621bc69624 Rename VerifyDiagnosticsClient to VerifyDiagnosticConsumer as per issue 5397
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140489 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26 00:38:03 +00:00
David Blaikie 78ad0b9884 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-25 23:39:51 +00:00
David Blaikie d6471f7c19 Rename Diagnostic to DiagnosticsEngine as per issue 5397
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-25 23:23:43 +00:00
David Blaikie eb2d1f1c88 Removing a bunch of dead returns/breaks after llvm_unreachables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 20:26:49 +00:00
David Blaikie b219cfc4d7 Switch assert(0/false) llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 05:06:16 +00:00
Argyrios Kyrtzidis b0c3e0909b Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-22 20:07:03 +00:00
Argyrios Kyrtzidis 2502efd261 [libclang] When pointing at a macro expansion inside a macro argument,
return a cursor for the inner macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140207 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 23:27:33 +00:00
Ted Kremenek 9503dce5a6 Sort exports list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 19:02:45 +00:00
Argyrios Kyrtzidis 92ddef1bf8 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:40:48 +00:00
Argyrios Kyrtzidis 507097ec40 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140060 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:40:35 +00:00
Argyrios Kyrtzidis a64ccefdf0 Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:40:19 +00:00
Erik Verbruggen b81d3012ff First test commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 15:03:11 +00:00
Argyrios Kyrtzidis 7ea51d5f0b [libclang] Remove libclang.darwin.exports, it's not used anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 23:12:36 +00:00
Argyrios Kyrtzidis e6be34d8f7 [libclang] Introduce clang_getPresumedLocation which works like clang_getExpansionLocation
but takes into account #line directives coming from preprocessed files.

Patch by Vinay Sajip!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139647 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 21:49:08 +00:00
Argyrios Kyrtzidis 221d5a5005 [libclang] Correct annotation and taking of cursor for objc class references
inside the IBOutletCollection attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139621 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:49:56 +00:00
Argyrios Kyrtzidis 18aa2ff464 Rename InterFace -> Interface, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139620 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 18:49:52 +00:00
Argyrios Kyrtzidis 6639e92554 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139609 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 17:39:31 +00:00
Douglas Gregor 78243658c5 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139570 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 01:26:44 +00:00
Argyrios Kyrtzidis c2954616fb [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139547 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 22:17:26 +00:00
Argyrios Kyrtzidis 40098e8cd7 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139511 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 18:09:31 +00:00
Douglas Gregor 08e0bc16b3 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139438 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10 00:09:20 +00:00
Douglas Gregor 35120c6285 The translation unit is never deserialized
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139436 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 23:34:14 +00:00
Anna Zaks 9134294114 [analyzer] When running scan-build with -plist on ./configure, delete the plist files.
(scan-build does not set the $HtmlDir when running against configure. Previously, this implied that the plist files would appear in the current directory, with this patch they will get deleted.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139382 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 18:43:53 +00:00
James Molloy 066d502b2d Fix up MCInstPrinter creation to take the new SubtargetInfo parameter (see LLVM r139237)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139238 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 17:25:30 +00:00
Anna Zaks 71f11d6a39 [analyzer] Revert a regression introduced in r133104(The ARC Migration Tool..) due to a merge error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-31 23:53:24 +00:00
Chandler Carruth 20174221af Update libclang to have APIs corresponding to the new 'expansion' naming
system for macro-backed source locations. The old APIs are preserved for
legacy users.

This was intended to land with the main work of instantiation ->
expansion, but despite running it by Doug over a month ago, I forgot to
commit it. Very sorry for that...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138860 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-31 16:53:37 +00:00
Argyrios Kyrtzidis 5f616b726f [libclang] Rename some functions and make sure we don't iterate past the tokens array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-30 19:43:19 +00:00
Matt Beaumont-Gay b22732365c Fix type mismatch in initialization (caught by -Wliteral-conversion)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138736 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-29 16:37:29 +00:00
Nico Weber e2c8663ad2 [analyzer] update bug report url
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-28 11:50:56 +00:00
Fariborz Jahanian 95ed7784a3 objective-c: Treat top-level objective-c declarations
, such as list of forward @class decls, in a DeclGroup
node. Deal with its consequence throught clang. This
is in preparation for more Sema work ahead. // rdar://8843851.
Feel free to reverse if it breaks something important
and I am unavailable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138709 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-27 20:50:59 +00:00
Douglas Gregor b5af843a20 Eliminate the -chained-pch flag and all of the frontend and libclang options associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138597 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-25 22:54:01 +00:00
Douglas Gregor 467dc88512 Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-25 22:30:56 +00:00
Argyrios Kyrtzidis 6f155de99c [libclang] Fix getting a cursor that points inside tag definition that is part
of a type specifier.

e.g. for:

typedef struct _MyS {
  int foo;
} MyS;

pointing at field 'foo' would give a cursor for the typedef declaration 'MyS'
instead of the field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138593 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-25 22:24:47 +00:00
Evan Cheng a6b4045dc4 Match LLVM change: TargetRegistry and TargetSelect have been moved to Support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138451 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-24 18:09:14 +00:00
Ted Kremenek 47695c8ad8 [libclang] Remove NestedNameSpecifierVisit, as Clang says that this code is dead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137999 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-18 22:25:21 +00:00
Argyrios Kyrtzidis a676379b26 [libclang] Annotate correctly macro argument tokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-18 18:03:34 +00:00
Ted Kremenek baf82b0fdf [libclang] Workaround potential race condition with code completion AllocatedResults being freed after a CXTranslationUnit.
The Container USR's CXString had its underlying data owned by the CXTranslationUnit's string pool.  This
would result in trying to access freed memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137887 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 22:19:53 +00:00
Argyrios Kyrtzidis 94fe9eee8c [libclang] Implicit objc methods are skipped, no need to check isSynthesized.
Plus, isSynthesized returning true does not mean that there is not a user-declared method declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137858 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 20:15:55 +00:00
Argyrios Kyrtzidis 75cf3e86d3 Mark objc methods that are implicitly declared for properties (not user-declared) as implicit.
This results in libclang ignoring such methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 19:25:08 +00:00
Argyrios Kyrtzidis 4b43b30534 [libclang] Make clang_getCursor able to handle locations that point inside macro arguments.
e.g. for:

\define INVOKE(METHOD, CLASS) [CLASS METHOD]

void test2() {
  INVOKE(meth, MyClass);
}

Pointing at 'meth' will give a CXCursor_ObjCMessageExpr and pointing at 'MyClass'
will give a CXCursor_ObjCClassRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 00:31:25 +00:00
Jim Grosbach 09190be8ef Update createMCAsmParser() to match r137735.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137736 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16 18:33:55 +00:00
Argyrios Kyrtzidis 427964e15f [libclang] Require explicit cursor visitation for all TypeLocs (compilation will
fail if a TypeLoc kind is not handled) and handle DecltypeTypeLoc and InjectedClassNameTypeLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137670 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15 22:40:24 +00:00
Argyrios Kyrtzidis 3422fbc38f [libclang] Handle AttributedTypeLoc for cursor visitation. Fixes rdar://9535717.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137634 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15 18:44:43 +00:00
Francois Pichet af0f4d0b2e Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.
Example:
template <class T>
class A {
public:
  template <class U> void f(U p) {  }
  template <> void f(int p) {  } // <== class scope specialization
};

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-14 03:52:19 +00:00
Nick Lewycky 83f06e8223 The diagtool registration system tries to use a global variable from a method
called on another global variable. Use ManagedStatic to ensure that the global
we register with actually exists when we need it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 01:14:22 +00:00
Douglas Gregor 6bf2b9fbd3 In the serialized AST format, make the translation unit a "predefined"
declaration that never actually gets serialized. Instead, serialize
the various kinds of update records (lexical decls, visible decls, the
addition of an anonymous namespace) for the translation unit, even if
we're not chaining. This way, we won't have to deal with multiple
loaded translation unit declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137395 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 00:15:20 +00:00
Ted Kremenek 0a20818384 scan-build: enable C++ support by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137382 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11 22:47:20 +00:00
Argyrios Kyrtzidis 8a4bfaa04b [libclang] When pointing at an objc property don't return a cursor that points at the
synthesized method for the property. rdar://9771715

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 21:12:04 +00:00
Douglas Gregor eaf4fbab08 Switch a C-style cast over to a const_cast. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 16:34:38 +00:00
Ted Kremenek e802c613f2 Place back previous order of add_subdirectory()'s to reflect build depedencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137117 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 14:55:12 +00:00
Ted Kremenek 7eab9d33e2 Add libsupport to list of libraries to link into diagtool
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137110 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 03:41:03 +00:00
Ted Kremenek 2dc651dfd4 Add 'diagtool' to the 'tools/' directory. diagtool is a new tool (WIP) for analyzing and working with clang diagnostics.
Some interesting stats from 'diagtool list-warnings' on the current version of clang:

  Percentage of warnings with flags: 48.79%
  Number of unique flags: 148
  Average number of diagnostics per flag: 2.041

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 03:39:19 +00:00
Ted Kremenek 38559ec75f Sort CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 03:39:10 +00:00
Douglas Gregor 8fa0a80b44 Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136911 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 20:04:59 +00:00
Chad Rosier 2b81910618 When the compiler crashes, the compiler driver now produces diagnostic
information including the fully preprocessed source file(s) and command line 
arguments.  The developer is asked to attach this diagnostic information to a 
bug report.
rdar://9575623


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136702 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02 17:58:04 +00:00
Douglas Gregor 0f91c8ccb3 When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136559 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 06:55:39 +00:00
Ted Kremenek d1194fbbf6 clang_getCXTUResourceUsage: report memory used by HeaderSearch.
This required converting the StringMaps to use a BumpPtrAllocator.  I measured the
compile time and saw no observable regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 23:46:11 +00:00
Ted Kremenek ca7dc2b755 clang_getCXTUResourceUsage: Report memory used by data structures in SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 23:46:06 +00:00
Benjamin Kramer a0651c5f5d Eliminate a bunch of temporary strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136092 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 16:59:25 +00:00
Douglas Gregor 0a47d69af8 Add new libclang API, clang_codeCompleteGetObjCSelector(), which
provides the partial Objective-C selector used in a code
completion. From Connor Wakamo!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136084 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 15:24:30 +00:00
Evan Cheng ccb21e4f2b Assembler really doesn't need to create TargetMachine anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 01:49:26 +00:00
Evan Cheng 7b6def7d17 Rename createCodeEmitter to createMCCodeEmitter; createObjectStreamer to createMCObjectStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 00:42:40 +00:00
Evan Cheng 3771235c9b Rename createAsmParser to createMCAsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136029 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 00:24:45 +00:00
Evan Cheng 21118dc86e Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 23:25:09 +00:00
Francois Pichet 48a8d14fc6 Fix the MSVC build. 2 problems:
- buildPieces was return a C++ object from inside an extern "C". (MSVC didn't like that)
   - clang_getCursorReferenceNameRange was missing a CINDEX_LINKAGE causing a link error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 22:00:44 +00:00
Chandler Carruth 642116259e Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 21:09:52 +00:00
Chandler Carruth a77c031cb6 Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:57:57 +00:00
Evan Cheng 75d8c91a5c Assembler doesn't need to initialize TargetMachine's anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135964 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:53:26 +00:00
Chandler Carruth e7b2b6e87d Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:52:32 +00:00
Douglas Gregor 430d7a1a62 Added clang_getCursorReferenceNameRange to libclang to to retrieve parts of
a cursor reference, from Erik Verbruggen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135920 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 17:48:11 +00:00
Chandler Carruth edc3dccece Rename SourceManager::getInstantiationRange to getExpansionRange.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 16:56:02 +00:00
Chandler Carruth 402785357a Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135914 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 16:49:02 +00:00
Douglas Gregor ab4e83b904 Extend libclang with clang_equalRanges, from Erik Verbruggen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135860 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 19:35:14 +00:00
Chris Lattner 2d3ba4f5a9 Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135855 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 17:14:25 +00:00
Chris Lattner 5f9e272e63 remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 10:55:15 +00:00
Evan Cheng 3db87b8103 Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135834 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 00:45:53 +00:00
Evan Cheng d99d3e1c01 Match LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-22 21:59:11 +00:00
Douglas Gregor e081a61bb0 New libclang API to expose container type for code completion, from
Connor Wakamo!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135651 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 01:05:26 +00:00
Douglas Gregor 4c30bb148b Rework the detailed preprocessing record to separate preprocessing
entities generated directly by the preprocessor from those loaded from
the external source (e.g., the ASTReader). By separating these two
sets of entities into different vectors, we allow both to grow
independently, and eliminate the need for preallocating all of the
loaded preprocessing entities. This is similar to the way the recent
SourceManager refactoring treats FileIDs and the source location
address space.

As part of this, switch over to building a continuous range map to
track preprocessing entities.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135646 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 00:47:40 +00:00
Chad Rosier d7a3ba03f6 Temporarily revert r135614 while I fix the cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135621 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 21:16:17 +00:00
Chad Rosier 2da13b1595 When the compiler crashes, the compiler driver now produces diagnostic information
including the fully preprocessed source file(s) and command line arguments.  The 
developer is asked to attach this diagnostic information to a bug report.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 20:26:32 +00:00
Evan Cheng 66488ed140 Match MCContext change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 19:53:19 +00:00
Chris Lattner 686775deca now that we have a centralized place to do so, add some using declarations for
some common llvm types: stringref and smallvector.  This cleans up the codebase
quite a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:58:45 +00:00
Evan Cheng 36fc3aa1e3 Match LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135570 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:22:27 +00:00
Douglas Gregor f62d43d2af Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 16:10:42 +00:00
Evan Cheng 2860e30d83 Match createTargetMachine API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135469 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 06:37:41 +00:00
Evan Cheng 884744b65e MCContext now takes MCRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 20:57:51 +00:00
Argyrios Kyrtzidis debb00f9ce [libclang] Map canonical decl of a category implementation to the category decl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135316 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 22:37:58 +00:00
Argyrios Kyrtzidis e2f854ddd3 Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 22:27:18 +00:00
John McCall 91a5755ad7 Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:09:51 +00:00
Evan Cheng e27eb59cb3 Match llvm API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135220 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 23:50:56 +00:00
Chandler Carruth cea731a9cb Clean up two lingering comments that mention 'instantiation' w.r.t.
macros in libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135148 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 16:07:57 +00:00
Chandler Carruth ba7537febd NestedMacroInstantiations -> NestedMacroExpansions
This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135141 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 09:02:10 +00:00
Chandler Carruth 9b2a0ac970 Update all of the libclang code corresponding to the preprocessor
MacroInstantiation -> MacroExpansion rename. Internally, everything is
switched.

Introduce a new cursor kind enum with the new name, but retain the old
name as an alias so that we don't break backwards compatibility.

Also update the debug printing routine to use 'macro expansions' as its
explicitly not guaranteed to be stable, and mechanically switch the test
cases over to that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 08:41:15 +00:00
Chandler Carruth 9e5bb85ac8 Move the rest of the preprocessor terminology from 'instantiate' and
variants to 'expand'. This changed a couple of public APIs, including
one public type "MacroInstantiation" which is now "MacroExpansion". The
rest of the codebase was updated to reflect this, especially the
libclang code. Two of the C++ (and thus easily changed) libclang APIs
were updated as well because they pertained directly to the old
MacroInstantiation class.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135139 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 08:20:46 +00:00
Argyrios Kyrtzidis 6e8090356f Fix CMake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134918 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 20:28:59 +00:00
Argyrios Kyrtzidis 97c337c2bd [arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix to 'clang_'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134916 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 20:15:00 +00:00
Evan Cheng 74e1332a94 Match createCodeEmitter change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134885 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 04:24:19 +00:00
Francois Pichet 9de09d43f6 Fix ARCMT/migrate.m on MSVC.
Solution is to set output stdout to binary mode to prevent newline conversion (\n => \r\n).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134879 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-10 19:48:34 +00:00
Joerg Sonnenberger 8db099012c Unbreak -cc1as mode after MC subtarget changes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134877 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-10 19:16:25 +00:00
NAKAMURA Takumi 23319f36d2 tools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to satisfy linking on cygming.
FIXME: tools/c-*.exe should be linked to clang.dll on cygming. llvm/Makefile.rules is not aware of bin/clang.dll.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134871 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-10 15:50:19 +00:00
NAKAMURA Takumi 0989bf7b7a c-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134859 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-10 03:10:43 +00:00
Argyrios Kyrtzidis bb540933aa Fix linker problem in buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 22:35:06 +00:00
Argyrios Kyrtzidis 4fc446fb07 Ugh, fix CMake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134848 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 22:05:50 +00:00
Argyrios Kyrtzidis 96210199a5 [libclang] Fix linker error in buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134847 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 21:35:58 +00:00
Argyrios Kyrtzidis 69325d5b7c [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.

<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.

Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.

Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.

rdar://9735086.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 20:00:58 +00:00
Evan Cheng f0733249ff cc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134811 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 07:32:07 +00:00
Evan Cheng bb36ed954a createAsmParser API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 06:04:17 +00:00
Chandler Carruth 4d6980bd07 Update the creation of the TargetAsmParser based on API change in r134678.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134680 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-08 03:15:48 +00:00
Joerg Sonnenberger ca0264320a Slightly improve the code to derive target from program name to not
fault if no arguments are given.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 16:57:26 +00:00
Douglas Gregor 3da626b4f3 Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134615 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 16:03:39 +00:00
Francois Pichet 08aa622ab9 MSVC doesn't like mixing declarations and statements in a C file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 22:09:44 +00:00
Evan Cheng 24c9db6f36 createMCInstPrinter doesn't need TargetMachine anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 19:45:57 +00:00
Douglas Gregor 39c411fa22 libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134495 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 16:43:36 +00:00