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

1862 Коммитов

Автор SHA1 Сообщение Дата
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
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