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

1266 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor eb8837b88c When using a precompiled preamble, keep track of the top-level
declarations that we saw when creating the precompiled preamble, and
provide those declarations in addition to the declarations parsed in
the main source file when traversing top-level declarations. This
makes the use of precompiled preambles a pure optimization, rather
than changing the semantics of the parsed translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 19:06:41 +00:00
Douglas Gregor 73dfa3d30a Add Darwin dylib versioning support to libclang when build with CMake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 20:52:32 +00:00
Daniel Dunbar f56a488a6b Frontend: Change PluginASTAction::ParseArgs to take a CompilerInstance object
for use in reporting diagnostics.
 - We don't want to use the Action's own CompilerInstance, because that is only
   initialized during file processing and I like that invariant.

Also, if ParseArgs returns false then abandon execution.

Also, remove unused PluginASTAction::PrintHelp virtual method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 15:31:28 +00:00
Daniel Dunbar edf29b00bc Driver: Keep track of a separate "install dir", which is the path where clang
was invoked from (which may not be where the executable itself is).
 - This allows having e.g., /Developer/usr/bin/clang be a symlink to some other
   location, while still making sure the Driver finds 'as', 'ld', etc. relative
   to itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 22:29:51 +00:00
Daniel Dunbar 5633c1e4a7 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 22:29:47 +00:00
Daniel Dunbar f9ae8f9f76 build: Don't pass -avoid-version or -no-undefined on Darwin, they don't do
anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-31 21:33:01 +00:00
Ted Kremenek 3ce9e7d270 Add clang_isPODType() for querying if the CXType is POD. Implements <rdar://problem/8250669>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109822 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 00:14:11 +00:00
Benjamin Kramer 7ac3d5a9ea Prepare for upcoming ownership change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 17:48:03 +00:00
Ted Kremenek a629ea42f6 Check for an invalid SourceLocation in clang_getCursor(). This avoids a possible assertion failure in SourceManager in the call to Lexer::GetBeginningOfToken(). Fixes <rdar://problem/8244873>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 00:52:07 +00:00
Douglas Gregor 6cd24e2881 Visit the children of CXXOperatorCallExprs in source order within
libclang, so that clang_annotateTokens() doesn't get confused and miss
annotations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 00:26:18 +00:00
Argyrios Kyrtzidis a6d6af308b Revert r109546, it broke linux build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 22:37:14 +00:00
Argyrios Kyrtzidis ee94e2d107 Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.

This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 22:01:17 +00:00
Dan Gohman 6be2a22979 Fix an apparent bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109447 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:44:15 +00:00
Douglas Gregor 3d398aa5c2 When LIBCLANG_CODE_COMPLETION_LOGGING is set in the environment, log code-completion command lines to stderr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 16:29:14 +00:00
Douglas Gregor 87c3007381 Eliminate the "minimal" and printing parser actions, which only ever
worked for C anyway. Also kills the -cc1 options -parse-noop and
-parse-print-callbacks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 04:08:02 +00:00
Douglas Gregor 45ba9a1b31 Start removing the use of smart pointers from the Parse/Sema
interaction, by effectively defaulting to
DISABLE_SMART_POINTERS. We're embracing the model where all AST nodes
are ASTContext-allocated and live as long as the ASTContext lives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-25 17:39:21 +00:00
Douglas Gregor 44c181aec3 Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 00:33:23 +00:00
Douglas Gregor a8e5c5bdbe Improve performance during cursor traversal when a region of interest
is present. 

Rather than using clang_getCursorExtent(), which requires
us to lex the token at the ending position to determine its
length. Then, we'd be comparing [a, b) source ranges that cover the
characters in the range rather than the normal behavior for Clang's
source ranges, which covers the tokens in the range. However, relexing
causes us to read the source file (which may come from a precompiled
header), which is rather unfortunate and affects performance.

In the new scheme, we only use Clang-style source ranges that cover
the tokens in the range. At the entry points where this matters
(clang_annotateTokens, clang_getCursor), we make sure to move source
locations to the start of the token.

Addresses most of <rdar://problem/8049381>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 20:22:31 +00:00
Ted Kremenek 664cffd330 Fix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is invalid' by checking that the body of a BlockDecl is null before constructing a CXCursor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 11:30:19 +00:00
Ted Kremenek f48b531382 Switch USR generation to use file offsets instead of line/columns for anonymous symbols. Fixes <rdar://problem/8221557>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109095 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 11:14:15 +00:00
Chandler Carruth 53513d2e24 This was still complaining about the length of the string. I've broken it here
to try to keep as much logical grouping as possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 06:29:13 +00:00
Douglas Gregor 5a43021ac4 Introduce a new C API function, clang_parseTranslationUnit(), which
will eventually replace
clang_createTranslationUnitFromSourceFile(). The only addition in
clang_parseTranslationUnit() is a set of flags that can control how
the translation unit is loaded. More interesting flags will be coming.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 18:52:53 +00:00
Douglas Gregor f033f1da4a Introduce a new lexer function to compute the "preamble" of a file,
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:18:03 +00:00
Douglas Gregor caf4bd3d3c Slip up long string literal
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 14:34:35 +00:00
Daniel Dunbar e5d69670b6 Driver: Switch to using a SmallVector instead of std::vector, and stop
accessing outside the range of the vector (which always asserts on Win32).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 02:47:40 +00:00
Douglas Gregor abc563f554 Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 21:46:24 +00:00
Rafael Espindola 8a1af325b4 Implement support for reading arguments specified in a file with @file. If
there is no file named "file", keep the @file option unchanged.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108697 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 15:20:12 +00:00
Daniel Dunbar 6658874a26 Revert r108672, "Implement support for reading arguments specified in a file
with @file.", it doesn't correctly handle cases where arguments starting with
'@' are passed to other command line arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 07:21:12 +00:00
Rafael Espindola 1c2ab11bc5 Implement support for reading arguments specified in a file with @file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 03:08:01 +00:00
Zhongxing Xu c6238d2786 Reapply r108617.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108668 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 01:31:21 +00:00
Daniel Dunbar 0bbad519aa Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
 - Fixes a problem where the Clang executable path was not initialized properly
   on Win32, because sys::Path::getBasename() doesn't do what I always think it
   does. Imagine that, a sys::Path interface that is confusing!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108667 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 00:44:04 +00:00
Daniel Dunbar e9122a36c4 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 00:33:53 +00:00
Rafael Espindola 06e35d3d02 Refactor the code a bit so that there is only one call to BuildCompilation. The
StringPointers vector will also be used in the normal case to handle @file
arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108660 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 22:03:55 +00:00
Benjamin Kramer ee30965ce9 Revert r108617, it broke the build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108621 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 13:51:58 +00:00
Zhongxing Xu 5a9ac23182 Fix cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108619 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 11:59:16 +00:00
Zhongxing Xu 69b81941aa Prepare the analyzer for the callee in another translation unit:
Let AnalysisContext contain a TranslationUnit.
  Let CallEnter refer to an AnalysisContext instead of a FunctionDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108617 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 11:12:42 +00:00
Daniel Dunbar 7374f1b407 clang -cc1as: Switch to using AsmParser constructor function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 02:26:21 +00:00
Daniel Dunbar c57b0ba341 build/Darwin: Add missing Info.plist template.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 20:26:56 +00:00
Daniel Dunbar 7bad56cd0c build/Darwin: Enable version information for clang executable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 19:33:44 +00:00
Douglas Gregor 1982c18522 Add a -code-completion-timing= mode to c-index-test, so that we can
test the performance of code-completion without testing the
performance of printf().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 18:38:41 +00:00
John Thompson 4156a4cbd5 Rename clang.dll to libclang.dll, to fix Windows build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-11 03:23:30 +00:00
Nick Lewycky 431495df8d Clang do so have plugins, we can't prune exports. Fixes plugin support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108054 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 20:19:47 +00:00
Douglas Gregor 52ddc5df59 Document my otherwise-inexplicable change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107998 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 18:39:07 +00:00
Douglas Gregor a0068fc643 Introduce -f{no-}spell-checking options to enable/disable
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 17:35:33 +00:00
Douglas Gregor ed8abf1832 Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 06:14:04 +00:00
Douglas Gregor 84745677f6 Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 23:37:33 +00:00
Douglas Gregor 016a4a90c8 Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 22:43:56 +00:00
Shantonu Sen d9d97265f9 Forward -fno-builtin to clang, add .cp as a supported
extension if you otherwise configure scan-build
to do c++ static analysis.

OKed by Ted


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107562 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-03 03:08:23 +00:00
Daniel Dunbar daa81c0683 MC: Pass the target instance to the AsmParser constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 20:41:59 +00:00
Daniel Dunbar 3d9c6e1c97 libclang: When invoking external clang process to get code completion results,
pass -ccc-clang-cxx to force C++ support (even if the binary was built without
it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107324 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 21:40:01 +00:00