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

1862 Коммитов

Автор SHA1 Сообщение Дата
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
Douglas Gregor 8be80e1e6e Improve the Python bindings for libclang in a few ways, from Eli
Bendersky. Specifically: 

* Implemented a new function in libclang: clang_isAttribute

* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows 

* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name) 
* Exposed clang_getCursorDisplayName to the python bindings



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 03:00:34 +00:00
John McCall 146060435c Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 08:33:18 +00:00
Evan Cheng 368691e5ac createTargetMachine now takes a CPU string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 02:06:32 +00:00
Argyrios Kyrtzidis 8ccac3de13 [libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 22:20:07 +00:00
Argyrios Kyrtzidis c5c5e92ec5 Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 22:20:04 +00:00
Eli Friedman 3963cef84a Revert unintentional commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 00:03:31 +00:00
Eli Friedman 0c051221bd Merge some calls to FoldingSetNodeID::AddInteger; assuming my measurements aren't completely off, roughly a 1% speedup on SingleSource/UnitTests/ObjC/trivial-interface.m .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 23:58:21 +00:00
Argyrios Kyrtzidis 064c44b8a1 [libclang] Avoid having the cursor of an expression replace the declaration cursor
when the expression source range overlaps the declaration range.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure pointing at 'foo' returns a VarDecl cursor.

rdar://9124499.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 19:42:23 +00:00
Argyrios Kyrtzidis 5517b89953 [libclang] Avoid having the cursor of an expression "overwrite" the annotation of the
variable declaration that it belongs to.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor.

rdar://9124499.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 19:42:20 +00:00
Douglas Gregor 03e8003051 Introduce a new AST node describing reference binding to temporaries.
MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

  const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value. 

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21 17:03:29 +00:00
Chandler Carruth 944eadbf3f Remove more unnecessary dependencies now that the Frontend -> ARCMigrate
edge has been broken.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-18 09:07:35 +00:00
NAKAMURA Takumi 25a2ef39e6 tools/arcmt-test: Don't attempt to link redundant libclang (clang-c).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-18 08:52:27 +00:00
Argyrios Kyrtzidis e665d6929e [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133323 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-18 00:53:41 +00:00
Chandler Carruth ba45fabfce Remove ARCMigrate from more builds that it isn't needed in now that the
layering problem has been addressed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133217 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 23:53:28 +00:00
John McCall 119bf6b42e c-index-test also depends on ARCMigrate, oh boy
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133147 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 05:29:03 +00:00
John McCall ae446421df ARCMigrate depends on libAnalysis, and on unhelpful linkers must appear
before it on the link line.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133145 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 04:30:11 +00:00
John McCall 979b423b37 Grr. Of course libARCMigrate depends on libRewrite. This is a lot to be
linking unnecessarily into libclang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133129 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 01:29:56 +00:00
Argyrios Kyrtzidis eaed19e241 [arcmt] Make arcmt-test accept cc1 options to make it more portable and hopefully fix MSVC failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133119 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 00:53:46 +00:00
John McCall a586c74b6a libFrontend depends on ARCMigrate, so link it into libclang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133116 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 00:38:00 +00:00
John McCall 8f0e8d2296 The ARC Migration Tool. All the credit goes to Argyrios and Fariborz
for this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:25:17 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
Tanya Lattner 61eee0ca33 Add support for builtin astype:
__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types.
Added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 00:47:47 +00:00
Douglas Gregor 352697a87b Expose @synthesize and @dynamic via their own cursor kinds in
libclang. Fixes <rdar://problem/9537904>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132603 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 23:08:58 +00:00
Douglas Gregor f968d83747 Objective-C doesn't consider the use of incomplete types as method
parameter types to be ill-formed. However, it relies on the
completeness of method parameter types when producing metadata, e.g.,
for a protocol, leading IR generating to crash in such cases.

Since there's no real way to tighten down the semantics of Objective-C
here without breaking existing code, do something safe but lame:
suppress the generation of metadata when this happens.

Fixes <rdar://problem/9123036>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27 01:19:52 +00:00
Argyrios Kyrtzidis 477aab6782 A StringRef-ication of the DiagnosticIDs API and internals.
Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132047 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25 05:05:01 +00:00
Sean Hunt ca63c20034 Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 22:41:36 +00:00
Joerg Sonnenberger d793350dee Support -fatal-warnings for the assembler frontend
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131662 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 18:42:29 +00:00
Argyrios Kyrtzidis 5adc0515aa Do some safety checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 22:09:53 +00:00
Douglas Gregor b83d4d7071 Add c-index-test printing and tests for static and virtual method
query functions, from Erik Verbruggen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 15:54:42 +00:00
Douglas Gregor 211924b563 Add clang_CXXMethod_isVirtual() to libclang, from Erik Verbruggen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131230 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-12 15:17:24 +00:00
Sean Hunt 10620eb516 Modify some deleted function methods to better reflect reality:
- New isDefined() function checks for deletedness
 - isThisDeclarationADefinition checks for deletedness
 - New doesThisDeclarationHaveABody() does what
   isThisDeclarationADefinition() used to do
 - The IsDeleted bit is not propagated across redeclarations
 - isDeleted() now checks the canoncial declaration
 - New isDeletedAsWritten() does what it says on the tin.
 - isUserProvided() now correct (thanks Richard!)

This fixes the bug that we weren't catching

void foo() = delete;
void foo() {}

as being a redefinition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131013 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06 20:44:56 +00:00
Douglas Gregor dca8ee8b7b Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.

Addresses <rdar://problem/9389320>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130990 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06 16:33:08 +00:00
Richard Smith 3e4c6c4c79 Implement support for C++0x alias templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 21:57:07 +00:00
Douglas Gregor 6df78739f3 When the environment variable LIBCLANG_RESOURCE_USAGE is set, teach
libclang to emit information about resource usage after parsing, code
completion, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130946 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 20:27:22 +00:00
Ted Kremenek 5e1db6a434 Enhance clang_getCXTUResourceUsage() to return the amount of memory used by the Preprocessor's bump allocator as well as those from the PreprocessingRecord.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130823 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 01:38:46 +00:00
Douglas Gregor dd3e5549e3 Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that
is intended to be guarded from multiple inclusions within the same
translation unit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130808 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 00:14:37 +00:00
Ted Kremenek 1d8052db5a Use the canonical decl when generating the locations for USRs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03 01:33:35 +00:00
Chandler Carruth 960d13dde3 Based on the new information in the AST provided by r130628, write
3 lines of code and improve a bunch of information in the libclang view
of the code.

Updates the two tests that exercise this with the new data, checking
that each new source location actually points back to the declared
template parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-01 09:53:37 +00:00
Rafael Espindola 1bf3902575 Update API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130588 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-30 03:46:18 +00:00
Ted Kremenek 8c367589b6 Guard in USRGenerator::GenLoc() against null Decl* from invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 21:35:23 +00:00
Ted Kremenek e9b5f3d4ac Enhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used by PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 23:46:20 +00:00
Ted Kremenek f61b831d7f Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 20:36:42 +00:00
Ted Kremenek ba29bd2551 Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContext's side tables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130383 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 04:53:38 +00:00
Ted Kremenek 457aaf0692 Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 04:10:31 +00:00
John Wiegley 28bbe4b8ac Parsing/AST support for Structured Exception Handling
Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130366 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 01:08:34 +00:00
John Wiegley 21ff2e516b Implementation of Embarcadero array type traits
Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 00:16:57 +00:00
Ted Kremenek 6bdda82234 Update regex in scan-build for parsing statistics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130347 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 23:43:27 +00:00
Ted Kremenek 251c27b629 Update scan-build to '-analyzer-checker debug.Stats' instead of the old '-analyzer-stats' -cc1 argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130320 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 18:53:08 +00:00
John McCall 864c041e11 Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function.  Diagnose this in the general case.  Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130239 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26 20:42:42 +00:00
John Wiegley 552622067d t/clang/expr-traits
Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130122 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-25 06:54:41 +00:00
Douglas Gregor 13c8ccb59b Teach libclang to be more careful around BlockDecls, and don't assume
that a TypeSourceInfo is always available, like we do everywhere else
in libclang. Fixes <rdar://problem/9311140>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130034 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-22 23:49:24 +00:00
Francois Pichet 8387e2a41e Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.
Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130022 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-22 22:18:13 +00:00
Nick Lewycky e8ba8d78a2 Wire up the -ftest-coverage and -fprofile-arcs flags to .gcno file emission (at
compile time) and .gcda emission (at runtime). --coverage enables both.

This does not yet add the profile_rt library to the link step if -fprofile-arcs
is enabled when linking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 23:44:07 +00:00
Douglas Gregor ffcd985dcb When translating a Clang source range into a libclang source range,
adjust the a ending macro location to the end of the instantiation
location before adjusting it to the end of the token. Fixes
<rdar://problem/9021561>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129872 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 21:16:21 +00:00
Ted Kremenek f787002478 Rename 'CXTUMemoryUsage…' to 'CXTUResourceUsage…'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129857 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 16:41:07 +00:00
Douglas Gregor e23ac65af5 Teach SourceManager::getSLocEntry() that it can fail due to problems
during deserialization from  a precompiled header, and update all of
its callers to note when this problem occurs and recover (more)
gracefully. Fixes <rdar://problem/9119249>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129839 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 00:21:03 +00:00
Ted Kremenek e294ab717f Add missing break statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129750 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 04:36:17 +00:00
Ted Kremenek 4e6a3f7310 Report memory usage for global code completion results in CXTUMemoryUsage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129733 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 23:42:53 +00:00
Francois Pichet 3c68336707 Unbreak the MSVC build: Don't mix variable declarations and statements in a .c file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129732 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 23:33:22 +00:00
Ted Kremenek 59fc1e55da Add libclang API to query how much memory is used by a CXTranslationUnit. This is a WIP. Currently we report
the amount used for expressions, types, identifiers, and selectors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129730 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 22:47:10 +00:00
Richard Smith 162e1c1b48 Support for C++11 (non-template) alias declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 14:24:37 +00:00
Peter Collingbourne f111d93572 C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages.  The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:35:48 +00:00
Richard Smith ad762fcdc1 Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 22:09:26 +00:00
Douglas Gregor 06d9b1ad0b Harden Clang's cursor visitation logic against NULL declaration,
statement, and expression pointers. While these shouldn't happen, it's
better to be safe in libclang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 21:41:34 +00:00
Ted Kremenek 5ca328fed2 Add Objective-C++ files to those accepted by ccc-analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 21:52:05 +00:00
Ted Kremenek 09fbf297da Provide options to explicitly enable/disable checkers in scan-build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:47:00 +00:00
Ted Kremenek ea8b01eb84 Enable C++ static analysis support in ccc-analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:46:57 +00:00
Oscar Fuentes 4656b63243 libclang output name is now libclang. This solves a name collision
when building with Visual Studio. `clang.dll' and `clang.exe' would
have the same `clang.ilk' and `clang.pdb'. On a serial build those
files would be overwritten as clang.exe/clang.dll are created. On a
parallel build there is a risk of both files being written at the same
time. On that case VS fails.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129239 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 02:29:27 +00:00
Daniel Dunbar c8a22b0916 Driver: Sketch driver support for a CC_LOG_DIAGNOSTICS options, similar to the
existing CC_PRINT_OPTIONS and CC_PRINT_HEADERS, which can be used to
transparently capture the compiler diagnostics from a build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 18:01:20 +00:00
John McCall 1de4d4e8cb Basic, untested implementation for an "unknown any" type requested by LLDB.
The idea is that you can create a VarDecl with an unknown type, or a
FunctionDecl with an unknown return type, and it will still be valid to
access that object as long as you explicitly cast it at every use.  I'm
still going back and forth about how I want to test this effectively, but
I wanted to go ahead and provide a skeletal implementation for the LLDB
folks' benefit and because it also improves some diagnostic goodness for
placeholder expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129065 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 08:22:57 +00:00
Ted Kremenek 4cd6ea9989 Filter our experimental checks in scan-build's checker listing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128865 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 00:21:49 +00:00
Ted Kremenek 9e4a1bb008 Don't store reports when scan-build's build command matches /autogen/ (same as configure).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128723 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-01 18:47:06 +00:00
Daniel Dunbar 402adc3bc0 Frontend/cc1as: Add support for -L.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128432 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 22:49:24 +00:00
Chris Lattner 7f9fc3f7ce switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128142 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 04:04:01 +00:00
Ted Kremenek 9d5a165d30 Fix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc() can return a SourceLocatin with an invalid
FileID on invalid code.  Fixes <rdar://problem/9164623>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128139 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 02:16:44 +00:00
Douglas Gregor 0a0d2b1790 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 00:50:03 +00:00
Ted Kremenek 4ee9926671 Hopefully fix VS build by not using std::vector::data().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 20:16:19 +00:00
Ted Kremenek 25a11e1c5f Rework crash recovery cleanup in ASTUnit and CIndex to recover more memory during a Sema crash (we have just a handful of leaks left)
and to use the simplified cleanup registration API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 01:15:24 +00:00
Ted Kremenek b26fbc1382 scan-build: only display analyzer intra-file progress when in "Verbose" mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128015 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 20:12:21 +00:00
Ted Kremenek 4f32786ac4 Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance
object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:40:17 +00:00
Bill Wendling ad3dfbe463 Pass in the TargetMachine parameter to the inst printer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127987 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 05:02:03 +00:00
Argyrios Kyrtzidis c842955140 In clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise
if '-x' flag is present it will be unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 18:17:52 +00:00
Ted Kremenek d2427ddf00 Add libclang hook 'clang_toggleCrashRecovery()', which provides a mechanism for a client to enable/disable CrashRecovery within libclang function calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127920 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 23:05:39 +00:00
Ted Kremenek 6628a614c5 Run all functional logic of clang_annotateTokens() within a CrashRecoveryContext. Fixes <rdar://problem/9121698>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 22:51:30 +00:00
Anders Carlsson 0d8d7e6067 Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127890 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 18:22:40 +00:00
Douglas Gregor 04a9eb3f0d When libclang visits a translation unit via clang_visitChildren(),
walk the preprocessing record *before* walking the declarations, so
they we pretend that we actually respect the phases of translation.

We still walk the preprocessing record after the declarations when
performing token annotation or finding the cursor at a location, since
those routines depend on those semantics.

Fixes <rdar://problem/9137195>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 23:23:30 +00:00
Ted Kremenek 5e48bcfa7f Compress argument processing in ccc-analyzer. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127758 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 21:10:42 +00:00
Joerg Sonnenberger 0ce89c6b36 Refactor program name logic. Extend it to infer the target triple from
the program name, if it includes it as proper prefix. This makes calling
clang with -ccc-host-triple x86_64-linux the same as calling it with the
name x86_64-linux-clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 20:15:43 +00:00
Ted Kremenek 37c2e96643 c-index-test shouldn't crash when a goto has no matching label. Fixes <rdar://problem/9123493>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127711 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 23:47:49 +00:00
Oscar Fuentes 6656457a0a Fix LIBCLANG_LINK_FLAGS for Darwin.
The previous syntax created a list with the usual semicolon as
separator, which breaks the link command.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 14:32:16 +00:00
Oscar Fuentes 0b34dbaafe Build libclang as a static library too. Now tested on Windows!
On Windows only the shared library is created. The reason for this is
that clang.lib the static library would clash with clang.lib the
export library of the dll.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127566 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-13 15:10:24 +00:00
Oscar Fuentes d9e9b8f195 Reverting "Build libclang as a static library too."
This reverts commit r127556. It breaks the build for MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127564 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-13 04:28:29 +00:00
Oscar Fuentes 29f4bacada Build libclang as a static library too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127556 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 22:01:58 +00:00
Abramo Bagnara 06dec892b5 Renamed OffsetOfNode::getRange to getSourceRange for uniformity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127534 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 09:45:03 +00:00
Peter Collingbourne f4e3cfbe8a Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof.  Original
patch by Guy Benyei.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 19:24:49 +00:00
Ted Kremenek 27871ea66f Tweak ccc-analyzer's 'Analyze' function to not mutate the original arguments list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127428 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 21:10:08 +00:00
NAKAMURA Takumi 6d5552131a c-index-test.c: Fix cygwin warning not to pass signed char to islower(c).
Cygwin's ctype.h says;
/* These macros are intentionally written in a manner that will trigger
   a gcc -Wall warning if the user mistakenly passes a 'char' instead
   of an int containing an 'unsigned char'.
   (snip) */

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127308 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 03:02:28 +00:00
Argyrios Kyrtzidis 299a4a967b Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.

Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 23:35:24 +00:00
NAKAMURA Takumi 893793b34c libclang/CIndexer.cpp: Apply a new API for Cygwin-1.7, instead of deprecated one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 22:17:33 +00:00
Douglas Gregor f52516038a Teach libclang's token-annotation logic about context-sensitive
keywords for Objective-C+ and C++0x. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 17:10:18 +00:00
Joerg Sonnenberger 9ade4ae4fb If called as *cpp or *cpp-[^-]*, run only the preprocessor. If no
input is specified, use stdin implicitly. Based on a patch from
Roman Divacky.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 23:31:01 +00:00
Douglas Gregor 841b238087 Rename the type argument for the iboutletcollection attribute to not
conflict with MinGW headers, from Kirk Beitz!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 18:55:32 +00:00
Argyrios Kyrtzidis b1c86492f9 Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 01:03:53 +00:00
Douglas Gregor 75e85048e7 Fix the source range for a member access expression that includes a
nested-name-specifier and improve the detection of implicit 'this'
bases. Fixes <rdar://problem/8750392>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126880 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 21:06:53 +00:00
Douglas Gregor c314aa4845 Teach libclang how to visit the children of a C++ base-class specifier
(i.e., the TypeLoc describing the base class type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 19:17:03 +00:00
Douglas Gregor b6744efecb Push nested-name-specifier source location information into template
template arguments. I believe that this is the last place in the AST
where we were storing a source range for a nested-name-specifier
rather than a proper nested-name-specifier location structure. (Yay!)

There is still a lot of cleanup to do in the TreeTransform, which
doesn't take advantage of nested-name-specifiers with source-location
information everywhere it could.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 17:09:35 +00:00
Douglas Gregor 94fdffa4a5 Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 20:11:18 +00:00
Douglas Gregor 9e876876af Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,
 
  enum clang::NestedNameSpecifier::SpecifierKind

Fixes in this iteration include:

  (1) Compute the type-source range properly for a dependent template
  specialization type that starts with "template template-id ::", as
  in a member access expression

    dep->template f<T>::f()

  This is a latent bug I triggered with this change (because now we're
  checking the computed source ranges for dependent template
  specialization types). But the real problem was...

  (2) Make sure to set the qualifier range on a dependent template
  specialization type appropriately. This will go away once we push
  nested-name-specifier locations into dependent template
  specialization types, but it was the source of the
  valgrind errors on the buildbots.
  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 18:12:44 +00:00
Douglas Gregor 2786864406 Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 17:25:47 +00:00
Douglas Gregor be38c5f5d8 Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 16:31:39 +00:00