Commit Graph

2402 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 9999f4f88b [libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
a separate thread for code-completion.

llvm-svn: 170978
2012-12-22 04:48:07 +00:00
Fariborz Jahanian 68a542aea7 Add objective-C style formatting to clang format and
use it to format xml declaration tags. 
// rdar://12378714

llvm-svn: 170727
2012-12-20 19:54:13 +00:00
Bill Wendling 4442605f18 Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.
llvm-svn: 170721
2012-12-20 19:22:21 +00:00
NAKAMURA Takumi f827eb629d c-index-test/Makefile: Add clangFormat to USEDLIBS for libclang-unavailable hosts.
llvm-svn: 170693
2012-12-20 13:30:10 +00:00
NAKAMURA Takumi 393bf4c3c8 c-index-test/Makefile: Reformat.
llvm-svn: 170692
2012-12-20 13:30:05 +00:00
Fariborz Jahanian 0389e528ab Audit DeclPrinter with -ast-dump on Cocoa.h and
fix any bad objectiveC syntax coming out of
DeclPrinter. This is on going. Also, introduce a new
PrintPolicy and use it as needed when declaration tag
is to be produced via DeclPrinter.

llvm-svn: 170606
2012-12-19 23:36:00 +00:00
Dmitri Gribenko 909eebc9ac Add a missing 'else'. Found by grep '} if'
No testcase because this did not affect correctness: a declaration can only be
ClassTemplateDecl or a FunctionTemplateDecl, not both.

llvm-svn: 170565
2012-12-19 17:29:30 +00:00
Fariborz Jahanian ae9d8aeb2b Improve on header comment suggested by James Dennet.
llvm-svn: 170555
2012-12-19 17:03:46 +00:00
Bill Wendling 7967fc14b9 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
2012-12-19 07:18:12 +00:00
Ted Kremenek 372735f342 Simplify logic to use SourceManager::getFileLoc(), per Argyrios's feedback.
llvm-svn: 170487
2012-12-19 01:16:49 +00:00
Fariborz Jahanian 799d96b8b8 fixes a doxygen comment.
llvm-svn: 170485
2012-12-19 01:00:36 +00:00
Fariborz Jahanian bbdb9f2653 Increas number of iterations before a new libclang format object
is created to 1000.

llvm-svn: 170481
2012-12-19 00:35:23 +00:00
Fariborz Jahanian b67908a07b Some code refactoring per Dimitri's comment.
llvm-svn: 170478
2012-12-19 00:01:48 +00:00
Ted Kremenek e3713d3025 Have clang_getSpellingLocation() use the same logic as DiagnosticRenderer for plowing through macros.
This fixes a subtle bug reported in <rdar://problem/12584554> where a double-nested
macro could lead to an incorrect fixit location with live issues.

This fix also uncovers a bunch of subtle bugs in our indexer test cases which
are now fixed (mostly around source ranges for attributes).

llvm-svn: 170468
2012-12-18 23:07:30 +00:00
Fariborz Jahanian 9b7ab87738 This is the libclang patch providing minimal API to
use clang's formatter. Currently, formatter is used 
to format declaration tags for xml comments. Since formatter
is in flux and its change will break several of the clang comment
tests, only a single tests is formatted using this facility.
Doug has reviewed and approved it for check-in. 

llvm-svn: 170467
2012-12-18 23:02:59 +00:00
Guy Benyei d8a08ea98d Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

llvm-svn: 170432
2012-12-18 14:38:23 +00:00
Guy Benyei 11169dded0 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
llvm-svn: 170431
2012-12-18 14:30:41 +00:00
Guy Benyei b13abb952a Add OpenCL images as clang builtin types.
llvm-svn: 170428
2012-12-18 12:30:03 +00:00
Eric Christopher 45f2e71571 Add support for passing the main file name down to the assembler
for location information.

Part of PR14624

llvm-svn: 170391
2012-12-18 00:31:10 +00:00
Chandler Carruth 4d5e1a9b34 Fix PR14625 by teaching the driver to detect PWD for assembly files.
This also requires adding support to -cc1as for passing the detecting
PWD down through LLVM's debug info (which in turn required the LLVM
change in r170371).

The test case is weak (we only test the driver behavior) because there
is currently to infrastructure for running cc1as in the test suite. So
those four lines are untested (much like all other lines in that file),
but we have a test for the same pattern using llvm-mc in the LLVM
repository.

llvm-svn: 170373
2012-12-17 21:40:04 +00:00
Argyrios Kyrtzidis fdea813c4a [c-index-test] Fix warnings about unused results from chdir().
Patch from Edwin Vane!

llvm-svn: 170366
2012-12-17 20:19:56 +00:00
Edwin Vane 524741fbbd Style and Doc fix for CommonOptionsParser
- Renaming GetCompilations() and GetSourcePathList() to follow LLVM
  style.
- Updating docs to reflect name change.
- Also updating help text to not mention clang-check since this class
  can be used by any tool.

Reviewed By: Alexander Kornienko

llvm-svn: 170229
2012-12-14 18:58:25 +00:00
NAKAMURA Takumi 92eb254c3c [CMake] Move libxml2 stuff from clang to llvm/cmake.
llvm-svn: 170225
2012-12-14 18:30:20 +00:00
Roman Divacky d93c8c008e Dont use/link ARCMT, StaticAnalyzer and Rewriter to clang when the user
specifies not to. Dont build ASTMatchers with Rewriter disabled and
StaticAnalyzer when it's disabled.

Without all those three, the clang binary shrinks (x86_64) from ~36MB
to ~32MB (unstripped).

llvm-svn: 170135
2012-12-13 16:09:42 +00:00
Argyrios Kyrtzidis 12023e1ec3 [libclang] Make sure tokens from preprocessor directives are annotated as such,
even if the directive is inside a declaration.

Fixes rdar://11548788 & http://llvm.org/PR12970

llvm-svn: 169949
2012-12-12 01:05:25 +00:00
Argyrios Kyrtzidis 23de34d6d6 [libclang] Declarations inside anonymous namespaces have internal linkage so
their USR should contain a location.

This uniques them from other declarations with the same name but in different translation units.
rdar://10546541

llvm-svn: 169647
2012-12-07 22:41:46 +00:00
Argyrios Kyrtzidis 8b71bc7d6b [libclang] Introduce a new indexing mode where we skip function bodies
that were already parsed in the same "indexing session".

An indexing session is defined as using the same CXIndexAction object
for multiple clang_indexSourceFile calls.
Passing CXIndexOpt_SkipParsedBodiesInSession as an indexing option will
enable the mode where we try to skip bodies that were already parsed in
another translation unit.

If a function's body was skipped, the "flags" field in the CXIdxDeclInfo
structure will have "CXIdxDeclFlag_Skipped" bit was set.

llvm-svn: 169539
2012-12-06 19:41:16 +00:00
Argyrios Kyrtzidis f75d498a3c [c-index-test] Introduce '-index-compile-db' which accepts a compilation database file
and does an '-index-file' for all compile commands in the database.

llvm-svn: 169430
2012-12-05 21:53:37 +00:00
NAKAMURA Takumi dfaed1bfde c-index-test.c: Make C89-compliant.
llvm-svn: 169277
2012-12-04 15:32:03 +00:00
Dmitri Gribenko b506ba1d79 libclang: Add a function to libclang for retrieving the bit width value
Patch by Jyun-Yan You.

llvm-svn: 169276
2012-12-04 15:13:46 +00:00
Chandler Carruth cc0694c8a4 Sort #include lines for tools/...
Completely automated with sort_includes.py

llvm-svn: 169240
2012-12-04 09:25:21 +00:00
Argyrios Kyrtzidis 6a33de18a3 [libclang] Avoid copying the CompileCommand related strings when wrapping them to a CXString.
llvm-svn: 169227
2012-12-04 07:26:48 +00:00
Argyrios Kyrtzidis 251ad5e06b Introduce CompilationDatabase::getAllCompileCommands() that returns all
compile commands of the database and expose it via the libclang API.

llvm-svn: 169226
2012-12-04 07:26:44 +00:00
Jordan Rose 85ff8f281e [analyzer] scan-build: Don't forget to close our temp file for Clang's output.
Also, minor whitespace/indentation fixes.

Patch by Peeter Joot!

llvm-svn: 168805
2012-11-28 19:12:44 +00:00
Jordan Rose dbbbf55119 [analyzer] scan-build: Treat '.C' files as C++.
Part of PR14443.

llvm-svn: 168804
2012-11-28 19:12:29 +00:00
Argyrios Kyrtzidis 9923d686d0 [libclang] Remove WorkingDir field from CIndexer, it has been rendered useless.
No functionality change.

llvm-svn: 168738
2012-11-27 22:49:42 +00:00
Rafael Espindola b0448cd52a Remove some dead code. CLANG_IS_PRODUCTION is now just a build flag and
is not used in any #ifdef.

llvm-svn: 168703
2012-11-27 16:10:37 +00:00
Jordan Rose a333f3fba1 scan-build: Respect TMPDIR on all platforms, not just Darwin (PR14438).
llvm-svn: 168672
2012-11-27 02:37:59 +00:00
Benjamin Kramer ba4c85e51d Make helpers static/anonymous.
llvm-svn: 168500
2012-11-22 15:02:44 +00:00
Daniel Dunbar cf3f2c49ea Revert r167801, "[preprocessor] When #including something that contributes no
tokens at all,". This change broke External/Nurbs in LLVM test-suite.

llvm-svn: 167858
2012-11-13 19:12:37 +00:00
Argyrios Kyrtzidis 4f10a3e9f0 [preprocessor] When #including something that contributes no tokens at all,
don't recursively continue lexing.

This avoids a stack overflow with a sequence of many empty #includes.
rdar://11988695

llvm-svn: 167801
2012-11-13 01:03:15 +00:00
Chad Rosier ad6e96d59c If we encounter a fatal error, exit with status 70. For BSD systems this is
defined as an internal software error.  This notifies the driver to report
diagnostics information.
rdar://11951540

llvm-svn: 167754
2012-11-12 21:32:24 +00:00
Chad Rosier 7ea7397ebc If we encounter a fatal error, call the interrupt handler to ensure any
temporary files are removed.
rdar://12282296

llvm-svn: 167741
2012-11-12 19:39:37 +00:00
Dmitri Gribenko 9fcad0947c Force C89 for c-index-test.c
MSVC supports only C89, so it is important to keep c-index-test.c
buildable with C89.  However, Clang defaults to C99, so while building
Clang with Clang one can introduce C99 constructs into c-index-test.c
without noticing.

Thanks to Nakamura Takumi for helping with MSVC bits.

llvm-svn: 167561
2012-11-07 23:52:25 +00:00
Jordan Rose 721567af3e [analyzer] Check that the argument to CFMakeCollectable is non-NULL.
Patch by Sean McBride!

llvm-svn: 167537
2012-11-07 17:12:37 +00:00
Argyrios Kyrtzidis d3a20f5974 [c-index-test] When building with BUILD_CLANG_ONLY=YES, include c-index-test.
It is part of libclang and has other uses besides running the clang tests.

llvm-svn: 167478
2012-11-06 19:14:25 +00:00
Ted Kremenek ccf3b4299d Remove completely irrelevant code from USR generation.
Thanks to Richard Smith for pointing this out.  This code stopped
serving its purpose during r103212 in a refactoring.  My initial
fix was to add back the logic to abort the USR generation for
InternalLinkage, but enough tests broke suspiciously that I fear
that USR generation for cursors with InternalLinkage is now expected
by some clients (where it wasn't the case when the refactoring
took place).  I don't own this code anymore and have not looked
at it for some time, but clearly this code is dead and can be removed
pending further review on the proper logic here.

llvm-svn: 167442
2012-11-06 06:36:45 +00:00
Argyrios Kyrtzidis 58a1d90d6a [c-index-test] Do install c-index-test because it's not just for tests,
it's also setup as 'INTERNAL_TOOL'.

llvm-svn: 167432
2012-11-06 02:12:21 +00:00
Richard Smith bd55daf2ee Remove first argument from Arg::getValue; it's been unused since r105760.
llvm-svn: 167211
2012-11-01 04:30:05 +00:00
Richard Smith 33fd551258 Remove CompilerInvocation::toArgs and clang -cc1test mode. These were untested
and apparently unused (and since they are untested, they're presumably also
broken).

llvm-svn: 167210
2012-11-01 03:48:49 +00:00