Commit Graph

2645 Commits

Author SHA1 Message Date
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
Argyrios Kyrtzidis b26a24cca2 [libclang] Introduce clang_Cursor_getReceiverType which returns the CXType for
the receiver of an ObjC message expression.

rdar://12578643

llvm-svn: 167201
2012-11-01 02:01:34 +00:00
Nick Lewycky acce2f88f3 Add missing emacs major mode marker.
llvm-svn: 166914
2012-10-29 06:03:58 +00:00
Nick Lewycky f7c59696e2 Fix name of this file.
llvm-svn: 166913
2012-10-29 06:03:40 +00:00
Nick Lewycky 0380545b3d Add missing emacs major mode marker.
llvm-svn: 166912
2012-10-29 06:02:59 +00:00
Dmitri Gribenko 1c1395e902 Comment to XML conversion: avoid memory allocation while pretty-printing the
declaration.

llvm-svn: 166707
2012-10-25 18:28:26 +00:00
NAKAMURA Takumi 4deb9a9b11 c-index-test.c: Split a format string. [-Woverlength-strings]
FIXME: They are still long strings without formatter in printf(3)!
llvm-svn: 166636
2012-10-24 22:52:04 +00:00
Argyrios Kyrtzidis e26c5571b2 [libclang] Add "-index-file-full" option that recursively indexes any imported
modules/PCH files.

llvm-svn: 166605
2012-10-24 18:29:15 +00:00
Douglas Gregor 811db4eac4 Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

llvm-svn: 166508
2012-10-23 22:26:28 +00:00
Sean Silva d901e82ec4 Fix some mdoc nits
Patch by Eitan Adler!

llvm-svn: 166482
2012-10-23 16:35:44 +00:00
Argyrios Kyrtzidis 118fafa301 [libclang] Add an environment variable to disable thread background priotity, for testing
llvm-svn: 166466
2012-10-23 04:09:38 +00:00
Dmitri Gribenko 923f305b2e Remove const_casts by propagating constness down to called functions.
llvm-svn: 166287
2012-10-19 16:51:38 +00:00
Fariborz Jahanian 9d2f1e753b [doc parsing] use getParamName to access parameter
for current(rewritten) comment and getParamNameAsWritten
to access param name coming with \param marker.

llvm-svn: 166231
2012-10-18 21:42:42 +00:00
NAKAMURA Takumi dbefa9b081 libclang/CXComment.cpp: Fix abuse of StringRef.
llvm-svn: 166163
2012-10-18 01:38:53 +00:00
Argyrios Kyrtzidis 5e2ec486bb [libclang] Invoke a ppIncludedFile callback when indexing implicit module imports.
llvm-svn: 166161
2012-10-18 00:17:05 +00:00
Fariborz Jahanian a7d76d2672 [Doc parsing]: This patch adds <Declaration> tag to
XML comment for declarations which pretty-prints
declaration. I had to XFAIL one test annotate-comments.cpp.
This test is currently unmaintainable as written.
Dmitri G., can you see what we can do about this test.
We should change this test such that adding a new tag does not wreck
havoc to the test.

llvm-svn: 166130
2012-10-17 21:58:03 +00:00
Derek Schuff a202096dc0 Add pnaclcall convention to Native Client targets.
Because PNaCl bitcode must be target-independent, it uses some
different bitcode representations from other targets (e.g. byval and
sret for structures). This means that without additional type
information, it cannot meet some native ABI requirements for some
targets (e.g. passing structures containing unions by value on
x86-64). To allow generation of code which uses the correct native
ABIs, we also support triples such as x86_64-nacl, which uses
target-dependent IR (as opposed to le32-nacl, which uses byval and
sret).

To allow interoperation between the two types of code, this patch adds
a calling convention attribute to be used in code compiled with the
target-dependent triple, which will generate code using the le32-style
bitcode. This calling convention does not need to be explicitly
supported in the backend because it determines bitcode representation
rather than native conventions (the backend just needs to undersand
how to handle byval and sret for the Native Client OS).

This patch implements __attribute__((pnaclcall)) to generate calls in
bitcode according to the le32 bitcode conventions, an attribute which
is accepted by any Native Client target, but issues a warning
otherwise.

llvm-svn: 166065
2012-10-16 22:30:41 +00:00
Fariborz Jahanian bbd469bef3 Fixes location of overriding declaration with no comment
of their own.

llvm-svn: 165972
2012-10-15 20:57:52 +00:00
Fariborz Jahanian 14ec3f3acb structured document comment: patch to provide comment for overriding function
template when comment is comming from overridden declaration. 
// rdar://12378793

llvm-svn: 165953
2012-10-15 18:58:50 +00:00
Ted Kremenek 639a17a229 Further harden checking that scan-view isn't serving up pages outside
the server root.

llvm-svn: 165839
2012-10-12 22:56:38 +00:00
Ted Kremenek 3073c58cab Have scan-view guard against serving up pages outside the root directory.
llvm-svn: 165815
2012-10-12 19:16:31 +00:00
NAKAMURA Takumi e259d912ab c-index-test.c: /* Use C style comment. */
llvm-svn: 165797
2012-10-12 14:25:52 +00:00
Fariborz Jahanian 42e31323b6 search for overridden methods with comment when overriding method
has none of its own. Factor in Doug's comments.
// rdar://12378793

llvm-svn: 165771
2012-10-11 23:52:50 +00:00
Sean Silva e2bb2ff576 Remove pointless classof()'s.
Updates to llvm/Support/Casting.h have rendered these classof()'s
irrelevant.

llvm-svn: 165770
2012-10-11 23:31:23 +00:00
Argyrios Kyrtzidis 8585f140bf [libclang] Make sure the index_data.main_filename field is initialized
in c-index-test. index_enteredMainFile is not invoked when indexing a
module file.

llvm-svn: 165735
2012-10-11 19:38:23 +00:00
Argyrios Kyrtzidis 9f57186983 [libclang] Add tests for indexing modules and PCHs using modules.
llvm-svn: 165732
2012-10-11 19:00:44 +00:00
Argyrios Kyrtzidis 0db720f0dc [libclang] Improve AST serialization done by ASTUnit::Save().
The ASTUnit needs to initialize an ASTWriter at the beginning of
parsing to fully handle serialization of a translation unit that
imports modules. Do this by introducing an option to enable it, which
corresponds to CXTranslationUnit_ForSerialization on the C API side.

llvm-svn: 165717
2012-10-11 16:05:00 +00:00
Ted Kremenek 45df60c1f3 Teach set-xcode-analyzer that the new default value for ExecPath is CLANG_ANALYZER_EXEC.
llvm-svn: 165681
2012-10-11 00:40:41 +00:00
Fariborz Jahanian 1c883b9b57 [Doc parsing] This patch searches overridden objc/c++
methods looking for documentation on a particular base
class inherited by any method that overrides the base class.
In case of redeclaration, as when objc method is defined
in the implementation, it also looks up for documentation
in class/class extension being redeclared.

llvm-svn: 165643
2012-10-10 18:34:52 +00:00
Jordan Rose d01e83ab3e Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.
This more accurately reflects its use: this flag is set when a method
matches the getter or setter name for a property in the same class,
and does not actually specify whether or not the definition of the method
will be synthesized (either implicitly or explicitly with @synthesize).

This renames the setter and backing field as well, and changes the
(soon-to-be-obsolete?) XML dump format to use 'property_accessor'
instead of 'synthesized'.

llvm-svn: 165626
2012-10-10 16:42:25 +00:00
NAKAMURA Takumi e9894029ba [CMake] clang/tools/extra may be included by LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR.
LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/llvm-srcroot/tools/clang/tools/extra, by default.

llvm-svn: 165620
2012-10-10 13:46:18 +00:00
Bill Wendling 59068d1302 Place temporary LTO files into their own subdirectory.
llvm-svn: 165600
2012-10-10 05:30:49 +00:00
Argyrios Kyrtzidis 15f6b8ebe8 Disable the preprocessing record when indexing a source file
and modules are not enabled.

llvm-svn: 165593
2012-10-10 02:12:50 +00:00
Argyrios Kyrtzidis e445c7236e When indexing a module file, for the ppIncludedFile callback give
an invalid location if the location points to the synthetic buffer
for the module input.

llvm-svn: 165592
2012-10-10 02:12:47 +00:00
Bob Wilson 0e504ff797 Revert "Use a special path to place the .o files in."
This reverts commit 165429 in an attempt to get our buildbots going.

llvm-svn: 165573
2012-10-09 23:57:08 +00:00
Argyrios Kyrtzidis b9556e695f Move the logic that searches for overridden methods from libclang to
ASTContext so that it can be widely available.

llvm-svn: 165473
2012-10-09 01:23:50 +00:00
Bill Wendling 99b0092a40 Use a special path to place the .o files in.
llvm-svn: 165429
2012-10-08 21:17:59 +00:00
Micah Villmow dd31ca10ef Move TargetData to DataLayout.
llvm-svn: 165395
2012-10-08 16:25:52 +00:00
Argyrios Kyrtzidis 6a80e7564f [libclang] Don't disable the preprocessing record while indexing so as
to not mess up with module building.

It was not worth trying to combine indexing without preprocessing record
and building modules with one because:

-just importing a module/PCH that was built with a pp record, enables it anyway
-the performance gain of indexing without the preprocessing record is insignificant.

llvm-svn: 165352
2012-10-06 01:18:35 +00:00
Ted Kremenek 450f9f29b2 Add color output to 'diagtool tree' to show what warnings are enabled by default.
llvm-svn: 165338
2012-10-05 22:07:14 +00:00
Argyrios Kyrtzidis dc78f3e7a9 [libclang] Now that we have a CXModule object, pass it to the
importedASTFile indexing callback.

llvm-svn: 165281
2012-10-05 00:22:40 +00:00
Argyrios Kyrtzidis 2b9b5bb697 [libclang] Introduce new C functions that provide information about modules:
clang_Cursor_getModule
clang_Module_getParent
clang_Module_getName
clang_Module_getFullName
clang_Module_getNumTopLevelHeaders
clang_Module_getTopLevelHeader

llvm-svn: 165280
2012-10-05 00:22:37 +00:00
Argyrios Kyrtzidis 50e5b1dab3 [libclang] Introduce CXCursor_ModuleImportDecl cursor kind, used for a module
import declaration.

llvm-svn: 165277
2012-10-05 00:22:24 +00:00
Bill Wendling 84ad5129a2 Add an explicit -object_path_lto flag during linking with a uniquified temporary
file name if building Apple-style.

llvm-svn: 165184
2012-10-03 23:49:57 +00:00
Bill Wendling a1ec84474b Remove the directory that these are already in.
llvm-svn: 165162
2012-10-03 21:08:21 +00:00
Argyrios Kyrtzidis f484b139db [libclang] When indexing, invoke the importedASTFile for PCH files as well.
llvm-svn: 165161
2012-10-03 21:05:51 +00:00
Argyrios Kyrtzidis 184b14428e [libclang] Simplify indexing of module imports by handling implicit
imports via ImportDecls.

llvm-svn: 165160
2012-10-03 21:05:44 +00:00
Benjamin Kramer 3da0563a35 clang-check: Add clangRewriteCore.a to the Makefile build to make it link again.
llvm-svn: 165119
2012-10-03 14:35:38 +00:00
Daniel Jasper 30abda1612 As opposed to the clang-fixit tool described on
http://clang.llvm.org/docs/ClangTools.html, this adds -fixit option to
clang-check. Thus, clang-check can become a general-purpose tool to run
clang capitalizing on the info stored in a compilation database.

Review: http://llvm-reviews.chandlerc.com/D51
llvm-svn: 165110
2012-10-03 13:28:43 +00:00
Dmitri Gribenko 61b1db1629 Comment to XML conversion: escape XML special chars correctly; use correct
regex for version tuples.

llvm-svn: 165104
2012-10-03 09:04:56 +00:00
Bill Wendling 766d4d22ac The top-level clang Makefile is #included into other Makefiles. (sigh) So we
can't have the logic here to add in the 'tools/{driver,libclang}' directories,
because they will be added in for ALL Makefiles which #include the top-level
one. Place the logic into the 'tools' Makefile.

llvm-svn: 165103
2012-10-03 08:39:19 +00:00
Argyrios Kyrtzidis e514b200aa Some renames to use the 'visitor' nomenclature, no functionality change.
llvm-svn: 165083
2012-10-03 01:58:28 +00:00
Fariborz Jahanian e61fc44c3d [Doc parse]: SUpport for message in deprecated/unavailable
attribute going iinto XML document.

llvm-svn: 165066
2012-10-02 23:01:04 +00:00
Argyrios Kyrtzidis 10e7846abf [libclang] When indexing an AST file, only deserialize the file level
declarations of the current primary module.

llvm-svn: 165046
2012-10-02 21:09:13 +00:00
Fariborz Jahanian de0ae1e406 [Doc parsing]: Add available and deprecated attribute info
to XML output. // rdar://12378879

llvm-svn: 165039
2012-10-02 20:05:47 +00:00
Argyrios Kyrtzidis d4fcf58070 [libclang] When indexing an AST file, only deserialize the preprocessing record
entities of the current primary module.

llvm-svn: 165023
2012-10-02 16:10:51 +00:00
Argyrios Kyrtzidis f590e094ad Add info in the preprocessing record whether an inclusion directive
resulted in an automatic module import.

llvm-svn: 165022
2012-10-02 16:10:46 +00:00
Argyrios Kyrtzidis b36ee5c592 [libclang] Even though we disable the preprocessing record during indexing,
make sure that it gets enabled for when a module needs to be created.

llvm-svn: 165021
2012-10-02 16:10:41 +00:00
Argyrios Kyrtzidis 472eda06b0 [libclang] Implement the importedASTFile indexing callback to provide
info about imported modules.

llvm-svn: 165020
2012-10-02 16:10:38 +00:00
Fariborz Jahanian c491c3f27a availability in structured documents. Takes
care of comments by Dimitri and Doug.

llvm-svn: 164957
2012-10-01 18:42:25 +00:00
Bill Wendling 446fb68894 Remove this hack in favor of another, better way of performing the same thing.
llvm-svn: 164915
2012-09-30 11:22:45 +00:00
Dmitri Gribenko 6743e04699 Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.

llvm-svn: 164892
2012-09-29 11:40:46 +00:00
Argyrios Kyrtzidis 19d78b743f For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.

llvm-svn: 164874
2012-09-29 01:06:10 +00:00
Fariborz Jahanian 35760a8937 [Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out).
Reviewed off-line by Doug. // rdar://12378879

llvm-svn: 164861
2012-09-28 22:35:49 +00:00
Argyrios Kyrtzidis 4fcd2885de Per discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html
have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets.

rdar://11113134 & http://llvm.org/PR13880

llvm-svn: 164743
2012-09-27 01:42:07 +00:00
Bill Wendling 3af41e6c5f Use a variable to stop us from building clang testing tools.
<rdar://problem/11202465>

llvm-svn: 164739
2012-09-27 00:11:09 +00:00
Ted Kremenek f81b0e387a Have set-xcode-analyer report an error if no xcspec file could be found.
llvm-svn: 164713
2012-09-26 18:19:55 +00:00
Ted Kremenek 66dfa34404 Make set-xcode-analyzer more tolerant of the naming differenes reported by xcode-select.
llvm-svn: 164712
2012-09-26 18:13:03 +00:00
Argyrios Kyrtzidis 9ae3956f22 [libclang] Remove the ParentKind cursor kind from code-completion results.
This is to reduce dependency to cursors for the code-completion results.

llvm-svn: 164705
2012-09-26 16:39:56 +00:00
Argyrios Kyrtzidis 39a76387e0 Have ASTUnit::Save() return a bool to indicate save error.
Removes a dependency of ASTUnit to clang-c/Index.h.

llvm-svn: 164704
2012-09-26 16:39:46 +00:00
Eli Friedman b826a00857 Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.

llvm-svn: 164656
2012-09-26 02:36:12 +00:00
Argyrios Kyrtzidis 341de09dcd [libclang] Do a AST concurrency check in clang_indexTranslationUnit_Impl.
llvm-svn: 164626
2012-09-25 19:29:50 +00:00
Benjamin Kramer 75e4bb1d87 ccc-analyzer: pass -stdlib=libc++ through to the analyzer.
Otherwise clang can't analyze code that relies on features provided by libc++.

llvm-svn: 164262
2012-09-19 22:56:24 +00:00
Roman Divacky 5bebfb7363 Follow up on llvm r164132.
llvm-svn: 164133
2012-09-18 16:09:16 +00:00
Dmitri Gribenko a664e5b88f Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
llvm-svn: 163983
2012-09-15 20:20:27 +00:00
Ted Kremenek b184a36aad Revert "Utilize new build system support in Xcode 4.5 for easier interposition"
It's not clear if this is working yet on the buildbot.  Reverting until we have
time to investigate.

llvm-svn: 163963
2012-09-15 05:51:10 +00:00
Ted Kremenek 460602e252 Utilize new build system support in Xcode 4.5 for easier interposition
of a build without needing to use ccc-analyzer.

llvm-svn: 163927
2012-09-14 19:06:33 +00:00
Jordan Rose c87e690372 scan-build: Determine the location of the clang binary before printing help.
We need the clang executable to print the list of available checkers.

llvm-svn: 163925
2012-09-14 18:59:03 +00:00
Richard Smith b15fe3a5e4 PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.

llvm-svn: 163672
2012-09-12 00:56:43 +00:00
Chandler Carruth 482942ed08 Just revert r163605 for now. It broke the build and had some
questionable elements to the patch.

llvm-svn: 163609
2012-09-11 10:40:21 +00:00
David Chisnall d81825aed7 Select the correct, or, failing that, compatible, dialect when invoked as cc,
c89, c99, and so on.  No change to the default dialect when invoked as clang /
clang++.

llvm-svn: 163605
2012-09-11 09:58:54 +00:00
Argyrios Kyrtzidis 68e87e1360 [libclang] Do index 'extern' declarations inside functions.
rdar://12257073

llvm-svn: 163563
2012-09-10 22:58:04 +00:00
Dmitri Gribenko 7acbf00f96 Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.
Now we have a list of all commands.  This is a good thing in itself, but it
also enables us to easily implement typo correction for command names.

With this change we have objects that contain information about each command,
so it makes sense to resolve command name just once during lexing (currently we
store command names as strings and do a linear search every time some property
value is needed).  Thus comment token and AST nodes were changed to contain a
command ID -- index into a tables of builtin and registered commands.  Unknown
commands are registered during parsing and thus are also uniformly assigned an
ID.  Using an ID instead of a StringRef is also a nice memory optimization
since ID is a small integer that fits into a common bitfield in Comment class.

This change implies that to get any information about a command (even a command
name) we need a CommandTraits object to resolve the command ID to CommandInfo*.
Currently a fresh temporary CommandTraits object is created whenever it is
needed since it does not have any state.  But with this change it has state --
new commands can be registered, so a CommandTraits object was added to
ASTContext.

Also, in libclang CXComment has to be expanded to include a CXTranslationUnit
so that all functions working on comment AST nodes can get a CommandTraits
object.  This breaks binary compatibility of CXComment APIs.

Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't
need TU parameter anymore, so it was removed.  This is a source-incompatible
change for this C API.

llvm-svn: 163540
2012-09-10 20:32:42 +00:00
Alexander Kornienko 02f481c42f Workaround for MacOSX build failure with gcc <= 4.4
Summary:
A better solution to http://llvm.org/bugs/show_bug.cgi?id=13777
Named namespace + more unique name to make ODR violations unlikely.

Reviewers: chandlerc, doug.gregor, klimek

Reviewed By: doug.gregor

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D38

llvm-svn: 163513
2012-09-10 14:54:38 +00:00
Alexander Kornienko 767cd03bbe Fixed http://llvm.org/bugs/show_bug.cgi?id=13777
llvm-svn: 163429
2012-09-07 22:44:34 +00:00
Joao Matos 566359c0bf Revert r163083 per chandlerc's request.
llvm-svn: 163149
2012-09-04 17:49:35 +00:00
Joao Matos f8c8bfc1fc Revert r163099 per chandlerc's request.
llvm-svn: 163147
2012-09-04 17:33:09 +00:00
Joao Matos 102f85655f Added a new cursor for SEHLeaveStmt to libclang.
llvm-svn: 163099
2012-09-03 00:23:40 +00:00
Joao Matos c32a7e4d8e Implemented parsing and AST support for the MS __leave exception statement. Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review.
llvm-svn: 163083
2012-09-02 03:45:41 +00:00
Argyrios Kyrtzidis b0b336ebe9 [libclang] Fix indexing type alias declarations. rdar://11878406
llvm-svn: 163072
2012-09-01 19:08:08 +00:00
Argyrios Kyrtzidis da188de2b6 [libclang] The annotation of tokens operation visits statement nodes code-recursively.
This can blow the stack with extremely deep hierarchies. Switch it to data-recursive.

This is implemented by introducing a post-children visitation callback that the
CursorVisitor is calling after child nodes of a cursor have been visited.
This is used by the annotate-tokens visitor to do extra work at that point.

rdar://11979525.

llvm-svn: 163071
2012-09-01 18:27:30 +00:00
Ted Kremenek 2ce4a8ff63 Comment that clang.dll is unavailable on cygming yet.
llvm-svn: 163055
2012-09-01 07:38:58 +00:00
NAKAMURA Takumi f7e150cc41 c-arcmt-test/Makefile: Restore some stuff. clang.dll is unavailable on cygming yet.
llvm-svn: 163054
2012-09-01 06:38:53 +00:00
Ted Kremenek 654a8158d1 Tweak link order to hopefully resolve a buildbot failure.
llvm-svn: 163052
2012-09-01 06:20:25 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00
Joao Matos e9a3ed4d71 Normalize line endings of r163013 (part 2).
llvm-svn: 163032
2012-08-31 22:18:20 +00:00
David Blaikie dcefd95d84 Fix the build (-Wswitch violation introduced by r163013).
llvm-svn: 163025
2012-08-31 21:55:26 +00:00
Joao Matos 251f4169da Normalize line endings of r163013.
llvm-svn: 163024
2012-08-31 21:41:22 +00:00
Joao Matos dc86f94f62 Improved MSVC __interface support by adding first class support for it, instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins.
llvm-svn: 163013
2012-08-31 18:45:21 +00:00
Michael Liao b94f47a8f5 Fix C++ comment in C source
llvm-svn: 162887
2012-08-30 00:45:32 +00:00
Ted Kremenek e29d2b8a66 Use double instead of single quote to expand .
llvm-svn: 162830
2012-08-29 07:22:34 +00:00
Ted Kremenek 2a226a61da Fix passing of -analyzer-max-loop from scan-build to clang.
llvm-svn: 162765
2012-08-28 16:48:48 +00:00
Argyrios Kyrtzidis 71c85b6a87 [libclang] When determining the cursor via a location, ignore synthesized ivars otherwise
if we have something like:

   @synthesize prop = _prop;

and '_prop' is not declared, we will encounter a '_prop' ivar before
encountering the 'prop' synthesize declaration and we will think that
we passed the region-of-interest, missing the cursor for 'prop'.

rdar://12172700

llvm-svn: 162715
2012-08-28 00:04:23 +00:00
Chad Rosier d9fb09a91b [ms-inline asm] Rename getClobber to getClobberStringLiteral. No functional
change intended.

llvm-svn: 162710
2012-08-27 23:28:41 +00:00
Ted Kremenek ca13244bb7 Change --with-analyzer to --use-analyzer, per sage feedback from Jordan.
llvm-svn: 162640
2012-08-25 05:24:46 +00:00
Chad Rosier de70e0ef45 [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

llvm-svn: 162632
2012-08-25 00:11:56 +00:00
Ted Kremenek 12cda3384a Fix a few issues related to -with-analyzer reported by Jordan. Let's
have the option with two '--' to be consistent with other options.

llvm-svn: 162625
2012-08-24 23:42:58 +00:00
Ted Kremenek 22708504f2 Rework how scan-build picks the version of clang to use for static analysis.
Unless the user specifies, the clang used for static analysis is the one
found relative to scan-build.

If the user specifies -with-analyzer, they can pick either to use
the clang bundled with Xcode (via xcrun) or they can specify
a path to clang.

llvm-svn: 162620
2012-08-24 23:08:08 +00:00
Ted Kremenek 2f65f465bf Reformat help text for scan-build, and remove -constraints
and -store from help text because they are no longer relevant
to users.

llvm-svn: 162619
2012-08-24 23:08:06 +00:00
Ted Kremenek 7c2137a328 Revert "Go ahead and show experimental checkers in the scan-build "-h" output."
llvm-svn: 162587
2012-08-24 20:39:38 +00:00
Ted Kremenek b5e409fd20 Go ahead and show experimental checkers in the scan-build "-h" output.
They are labeled as not being enabled-by-default, and how else
are users going to test them.

Fixes <rdar://problem/11654923>

llvm-svn: 162543
2012-08-24 06:49:34 +00:00
Ted Kremenek af592eef7b On OS X, use xcrun (if present) to find the clang to use for static analysis if
no clang can be found relative to the location of scan-build.

Fixes <rdar://problem/11691794>

llvm-svn: 162535
2012-08-24 04:53:06 +00:00
Alexander Kornienko 4bcd58b87d Updated LibTooling.html, minor improvements in CommonOptionsParser
llvm-svn: 162521
2012-08-24 00:39:14 +00:00
Jordan Rose 060b163801 [scan-build] Accept -fno-objc-arc as well as -fobjc-arc.
This is how Xcode lets individual files be marked as non-ARC when the rest
of the project is ARC-enabled, so this is necessary for scan-build xcodebuild.

Patch by Paul Eipper!

llvm-svn: 162497
2012-08-23 23:16:34 +00:00
Dmitri Gribenko adba9be7c5 Fix a bunch of -Wdocumentation warnings.
llvm-svn: 162452
2012-08-23 17:58:28 +00:00
Argyrios Kyrtzidis 079ff5c6da [libclang] c-index-test: Make the printing of the overrides list of a cursor in
a deterministic order, to avoid random test failures.

llvm-svn: 162408
2012-08-22 23:15:52 +00:00
Alexander Kornienko 01387267c7 Reverted clang-check to fully supported CommandLine Library use-case: global
static variables.

llvm-svn: 162391
2012-08-22 20:52:52 +00:00
Alexander Kornienko bf4871d363 Implemented -ast-dump, -ast-print, -ast-dump-filter options in clang-check
llvm-svn: 161753
2012-08-13 10:50:08 +00:00
Dmitri Gribenko a43ec186a4 Attaching comments to declarations: find comment attached to any redeclaration
Not only look for the comment near the declaration itself, but also walk the
redeclaration chain: the previous declaration might have had a documentation
comment.

llvm-svn: 161722
2012-08-11 00:51:43 +00:00
Benjamin Kramer 3a913ed805 Fix a couple of pedantic gcc warnings.
llvm-svn: 161656
2012-08-10 10:06:13 +00:00
NAKAMURA Takumi 5c10810754 c-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.
llvm-svn: 161655
2012-08-10 06:10:58 +00:00
Chandler Carruth 6f71e24859 Temporarily revert r161612 while we figure out just what the semantics
of PARALLEL_DIRS are. They apparantly aren't what either Nick, Eric, or
I thought. ;] Should let the bots make forward progress.

llvm-svn: 161618
2012-08-09 21:02:52 +00:00
Chandler Carruth 69335414c1 Make all of the tools build in parallel. Missing this caused incremental
rebuilds to serially link each tool, which is really really slow.

We still have to build libclang serially first because c-index-test
depends on it.

llvm-svn: 161612
2012-08-09 20:40:24 +00:00
Chandler Carruth 60a232c82d Recurse into the extra tools repo the correct way from the Makefile
build system. Thanks to Nick for pointing at the actual construct which
should be used here.

llvm-svn: 161609
2012-08-09 20:21:38 +00:00
Dmitri Gribenko ba7aca3b38 Comment to HTML and XML conversion: ignore commands that contain a declaration
as their argument.  For example, \fn, \function, \typedef, \method, \class etc.

llvm-svn: 161601
2012-08-09 18:20:29 +00:00
Dmitri Gribenko dcbc8ce2b5 Comment to HTML and XML conversion: use CommandTraits to classify commands.
This also fixes a bug in comment to XML conversion: \result was just an
ordinary paragraph, not an alias for \returns.

llvm-svn: 161596
2012-08-09 17:33:20 +00:00
Chad Rosier bf40d6b6a5 [ms-inline asm] Add various MC components to clang build to support MS-style inline assembly.
llvm-svn: 161594
2012-08-09 17:17:01 +00:00
Chandler Carruth ac83232974 Allow the Makefile build system to find the extra repo if it is checked
out.

Unfortunately, the existing makefiles for the extra repo don't specify
the correct library dependencies. Fixing that next. If you're following
along, you'll get linker errors.

llvm-svn: 161549
2012-08-09 00:05:27 +00:00
Dmitri Gribenko 6cffc1928a Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.

llvm-svn: 161531
2012-08-08 22:10:24 +00:00
Chad Rosier 4577cd3036 Add various MC components to clang build to support MS-style inline assembly.
llvm-svn: 161498
2012-08-08 16:27:29 +00:00
Ted Kremenek 7c88d2ae0f Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
llvm-svn: 161443
2012-08-07 19:27:08 +00:00
Dmitri Gribenko 168d23414a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

llvm-svn: 161442
2012-08-07 18:59:04 +00:00
Dmitri Gribenko 815f72bac7 c-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
llvm-svn: 161439
2012-08-07 18:36:33 +00:00
Dmitri Gribenko 740c0fbe0e libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!

llvm-svn: 161431
2012-08-07 17:54:38 +00:00
Chandler Carruth 1479492125 Initial support for recursing into the new clang-tools-extra repository
if checked out under clang/tools/extra.

This is mostly so folks other than me can start to test. Documentation,
details, and an announcement are still in the works.

llvm-svn: 161405
2012-08-07 08:37:42 +00:00
Ted Kremenek b9ddbd3daa scan-build: factor out setting of environment variables.
llvm-svn: 161343
2012-08-06 20:19:19 +00:00
Ted Kremenek 0d29bd231b Pull 'xcodebuild' wrapper logic into a separate function.
llvm-svn: 161330
2012-08-06 18:54:19 +00:00
Dmitri Gribenko 58e4131995 Comment to HTML conversion: correct typo in CSS class name: taram -> tparam
llvm-svn: 161145
2012-08-01 23:47:30 +00:00
Dmitri Gribenko 3a770d0fe4 Comment to HTML conversion: refactor. Extracted a class to for FullComment
semantic parts -- this will be reused for comment to XML conversion.

llvm-svn: 161139
2012-08-01 22:48:16 +00:00
Dmitri Gribenko 307cf89b19 Comment to HTML conversion: skip \tparam commands with whitespace paragraphs
llvm-svn: 161096
2012-08-01 00:48:00 +00:00
Dmitri Gribenko 7c0456f91b Comment to HTML conversion: escape HTML special characters in command arguments
llvm-svn: 161094
2012-08-01 00:21:12 +00:00
Dmitri Gribenko 34df220410 Comment parsing: add support for \tparam command on all levels.
The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this
breaks libclang binary compatibility, but should not be a problem since API is
so new.

This also fixes PR13372 as a side-effect.

llvm-svn: 161087
2012-07-31 22:37:06 +00:00
David Blaikie 5ba8be0e9a Include clang-check as part of the clang installation.
This also tidies up a couple of other tools we were (partially) installing:
* c-index-test was being installed but shouldn't be (it's just a clang-dev tool)
* diagtool was being installed in cmake but not make (& shouldn't be installed in either)

Review by Manuel Klimek, Doug Gregor, and Chandler Carruth.

llvm-svn: 161073
2012-07-31 20:29:59 +00:00
Dmitri Gribenko 3af5f73344 Move comment from member operator() to class.
llvm-svn: 160980
2012-07-30 19:47:34 +00:00
Dmitri Gribenko ec551f67e5 c-index-test: remove dead store. Found by Clang static analyzer!
llvm-svn: 160974
2012-07-30 18:00:35 +00:00
Dmitri Gribenko 5de4c064c1 Add missing include for Linux buildbot
llvm-svn: 160971
2012-07-30 17:49:32 +00:00
Dmitri Gribenko a260c030b8 Add an assert to ParamCommandComment::getParamIndex() -- it should not be
called unless index is valid.

llvm-svn: 160970
2012-07-30 17:38:19 +00:00
Arnaud A. de Grandmaison e00629f777 [scan-build] Fix clang++ pathname
llvm-svn: 160871
2012-07-27 17:10:06 +00:00
NAKAMURA Takumi a9a35c67e1 libclang, examples: [CMake] Add dependencies to tblgen'd headers.
llvm-svn: 160849
2012-07-27 06:17:56 +00:00
Alexander Kornienko cdc3987ca8 Removed standalone clang-ast-dump tool.
llvm-svn: 160772
2012-07-26 01:44:18 +00:00
Dmitri Gribenko 6b375193a2 libclang comment to HTML rendering: \result is the same as \returns
llvm-svn: 160738
2012-07-25 17:14:58 +00:00
Dmitri Gribenko 378458d597 libclang comments AST: clang_ParamCommandComment_getParamName: don't assert
when a \param command does not have a parameter name, just return an empty
string instead.

llvm-svn: 160638
2012-07-23 19:41:49 +00:00
Dmitri Gribenko d73e4ce992 Comment AST: add InlineContentComment::RenderKind to specify a default
rendering mode for clients that don't want to interpret Doxygen commands.

Also add a libclang API to query this information.

llvm-svn: 160633
2012-07-23 16:43:01 +00:00
Dmitri Gribenko 4c6d7a2ed2 Comment to HTML conversion: add more CSS classes to identify function arguments
by index.  This is useful if the user does not document all arguments, and we
can't find a particular argument by index via :nth-of-type() CSS selector.

llvm-svn: 160595
2012-07-21 01:47:43 +00:00
Dmitri Gribenko f267c87e31 Fix c-index-test to compile as C89.
llvm-svn: 160582
2012-07-20 22:00:35 +00:00
Dmitri Gribenko 5e4fe00e64 Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment.

For testing, c-index-test now has even more output:
* HTML rendering of a comment
* comment AST tree dump in S-expressions like Comment::dump(), but implemented
* with libclang APIs.

llvm-svn: 160577
2012-07-20 21:34:34 +00:00
NAKAMURA Takumi e6c562c051 CMake: clang should depend on clang-headers, or bin/clang would not work better.
llvm-svn: 160549
2012-07-20 16:40:09 +00:00
NAKAMURA Takumi ed5bbe9020 [Win32] Rework crash-report since r145389.
- lib/Driver/Driver.cpp, tools/driver/driver.cpp: Exit status should not be propagated, although clang driver should catch exceptions.
  - test/Driver/crash-report.c: Add REQUIRES:shell for now.
    FIXME: setenv should work also on Lit.InternalShellRunner.
  - test/Driver/crash-report.c: Remove XFAIL.

Thanks to Chad, To point out the issue.

llvm-svn: 160343
2012-07-17 05:09:29 +00:00
Dmitri Gribenko f290b0d137 Move clang_Cursor_getBriefCommentText implementation under `extern "C"'.
llvm-svn: 160331
2012-07-17 00:17:45 +00:00
Ted Kremenek 4abbade558 Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
when using Python < 2.7.0.  This is the case on Snow Leopard, where the tools are always
installed in /Developer.  This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.

llvm-svn: 160321
2012-07-16 21:39:29 +00:00
Alexander Kornienko f2f82550fd The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
llvm-svn: 160265
2012-07-16 12:46:48 +00:00
Alexander Kornienko 8480d420d3 Updated -help message in clang-check.
Summary: Provide more information on usage in -help

Test Plan: ran once

Reviewers: klimek, chandlerc, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D5

llvm-svn: 160132
2012-07-12 14:34:23 +00:00
Dmitri Gribenko f26054f0fb Enable comment parsing and semantic analysis to emit diagnostics. A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by 
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to 
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).

llvm-svn: 160078
2012-07-11 21:38:39 +00:00
Argyrios Kyrtzidis 6d7833f1b6 Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

llvm-svn: 160074
2012-07-11 20:59:04 +00:00
Daniel Jasper 1808bbedaf Fix usage instructions for clang-check.
llvm-svn: 160048
2012-07-11 15:05:24 +00:00
Arnaud A. de Grandmaison 617f5269c3 Adds support for auto-detection of compilation databases, looking in a directory and all its parents.
llvm-svn: 159998
2012-07-10 16:56:35 +00:00
Manuel Klimek 65fd0e1fd3 Adds support for auto-detection of compilation databases
from a source file and changes clang-check to make use of this.

This makes clang-check just work on in-tree builds, and allows
easy setup via a symlink per source directory to make clang-check
work without any extra configuration.

llvm-svn: 159990
2012-07-10 13:10:51 +00:00
Ted Kremenek 30105f67b4 Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.
llvm-svn: 159893
2012-07-07 06:30:31 +00:00
Ted Kremenek b22ea2acea Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

llvm-svn: 159892
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi eec53e4069 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

llvm-svn: 159886
2012-07-07 02:48:02 +00:00
Ted Kremenek 9877f689f2 Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

llvm-svn: 159875
2012-07-06 23:07:31 +00:00
Richard Smith 1ea42eb5a3 Fix some memory leaks found by the static analyzer. Thanks to John Smith for running it over Clang.
llvm-svn: 159732
2012-07-05 08:20:49 +00:00
Arnaud A. de Grandmaison fa6d73cc90 [libclang] CompilationDatabase naming and comment fixes
llvm-svn: 159682
2012-07-03 20:38:12 +00:00
Argyrios Kyrtzidis b6df682194 [libclang] Introduce clang_Cursor_isDynamicCall which,
given a cursor pointing to a C++ method call or an ObjC message,
returns non-zero if the method/message is "dynamic", meaning:

  For a C++ method: the call is virtual.
  For an ObjC message: the receiver is an object instance, not 'super' or a
  specific class.

rdar://11779185

llvm-svn: 159627
2012-07-02 23:54:36 +00:00
Dmitri Gribenko 3292d06a1b Add a new libclang completion API to get brief documentation comment that is
attached to a declaration in the completion string.

Since extracting comments isn't free, a new code completion option is
introduced.

A new code completion option that enables including brief comments
into CodeCompletionString should be a, err, code completion option.
But because ASTUnit caches global declarations during parsing before
even completion consumer is created, the option is duplicated as a
translation unit option (in both libclang and ASTUnit, like the option
to cache code completion results).

llvm-svn: 159539
2012-07-02 17:35:10 +00:00
NAKAMURA Takumi 98346f92f2 c-index-test/Makefile: Tweak USEDLIBS for cygwin. cygclang.dll is not linked to c-index-test yet.
llvm-svn: 159499
2012-07-01 00:40:17 +00:00
Arnaud A. de Grandmaison 2b3c860397 [libclang] Make implementation filename match the header's name for CXCompilationDatabase
llvm-svn: 159493
2012-06-30 20:43:43 +00:00
Arnaud A. de Grandmaison de7176ea55 [libclang] Fix autoconf library dependencies for tooling support
llvm-svn: 159490
2012-06-30 12:49:09 +00:00
NAKAMURA Takumi 1e43baa602 c-index-test.c: Fix missing semicolon(s).
llvm-svn: 159486
2012-06-30 11:47:18 +00:00
Arnaud A. de Grandmaison 0fe28a1a84 [libclang] add CompilationDatabase support
llvm-svn: 159484
2012-06-30 11:27:57 +00:00
Argyrios Kyrtzidis 30a2432682 [libclang] Don't bind a StringRef to a temporary std::string object.
It may end up pointing at garbage.

Fixes the MSVC debug build. rdar://11703319

llvm-svn: 159377
2012-06-28 21:03:08 +00:00
Dmitri Gribenko 5c8897d37d Remove redundant check.
llvm-svn: 159355
2012-06-28 16:25:36 +00:00
Dmitri Gribenko 5188c4b9cc Implement a lexer for structured comments.
llvm-svn: 159223
2012-06-26 20:39:18 +00:00
Jordan Rose 21e22dbeb7 [diagtool] Appease buildbots by explicitly using makeArrayRef.
llvm-svn: 159095
2012-06-24 00:27:36 +00:00
Jordan Rose 473e877c43 [diagtool] Add a new "tree" command to shows warnings activated by a flag.
% diagtool tree -Wunused-value
-Wunused-value
  -Wunused-comparison
    warn_unused_comparison
  -Wunused-result
    warn_unused_result
  warn_unused_call
  warn_unused_container_subscript_expr
  warn_unused_expr
  warn_unused_property_expr
  warn_unused_voidptr

llvm-svn: 159093
2012-06-24 00:07:45 +00:00
Anna Zaks 7aa3687bb6 [analyzer]scan-build: report the total number of steps analyzer performs
This would be useful to investigate performance issues.

llvm-svn: 159038
2012-06-22 22:08:12 +00:00
Jordan Rose b820709144 [diagtool] Write to llvm::outs() by default instead of llvm::errs()
llvm-svn: 158954
2012-06-22 00:33:20 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Chandler Carruth 39a3e7544a Fix a big layering violation introduced by r158771.
That commit added a new library just to hold the RawCommentList. I've
started a discussion on the commit thread about whether that is really
meritted -- it certainly doesn't seem necessary at this stage.

However, the immediate problem is that the AST library has a hard
dependency on the Comment library, but the dependencies were set up
completely backward. In addition to the layering violation, this had an
unfortunate effect if scattering the Comments library dependency
throughout the build system, but inconsistently so -- several parts of
the CMake dependencies were missing and only showed up due to transitive
deps or the fact that the target wasn't being built by tho bots.

It turns out that the Comments library can't (currently) be a well
formed layer *below* the AST library either, as it has an API that
accepts an ASTContext. That parameter is currently unused, so maybe that
was a mistake?

Anyways, it really seems like this is logically part of the AST --
that's the whole point of the ASTContext providing access to it as far
as I can tell -- so I've merged it into the AST library to solve the
immediate layering violation problems and remove some of the churn from
our library dependencies.

llvm-svn: 158807
2012-06-20 09:53:52 +00:00
Rafael Espindola c757570032 Fix cmake build.
llvm-svn: 158782
2012-06-20 01:18:08 +00:00
Dmitri Gribenko aab8383a2b Structured comment parsing, first step.
* Retain comments in the AST
* Serialize/deserialize comments
* Find comments attached to a certain Decl
* Expose raw comment text and SourceRange via libclang

llvm-svn: 158771
2012-06-20 00:34:58 +00:00
Ted Kremenek 00c31c888b Adjust scan-build to enable color output for xterm-256color.
llvm-svn: 158735
2012-06-19 19:27:28 +00:00
Ted Kremenek 9dcc0325de Sink definition of IBOutlet, IBOutletCollection, and IBAction into
the compiler predefines buffer.  These are essentially part of
the Objective-C language.

llvm-svn: 158690
2012-06-19 00:37:39 +00:00
Jordan Rose 2fa69ef934 Add new tool 'diag-build' for showing enabled warnings in a project.
diag-build acts as a wrapper for 'diagtool show-enabled', in the same way
that scan-build acts as a wrapper for the static analyzer. The common case is
simple: use 'diag-build make' or 'diag-build xcodebuild' to list the warnings
enabled for the first compilation command we see. Other build systems require
you to manually specify "dry-run" and "use $CC and $CXX"; if there is a build
system you are interested in, please add it to the switch statement.

diag-build is fairly stupid right now, but it serves its basic purpose.
Hopefully it can grow to meet any additional requirements.

llvm-svn: 158682
2012-06-18 21:31:37 +00:00
NAKAMURA Takumi f32f4f46b4 diagtool/CMakeLists.txt: Add missing tblgen'd dependency, ClangDiagnosticIndexName.
llvm-svn: 158649
2012-06-17 15:41:44 +00:00
Chad Rosier 32503020a4 Etch out the code path for MS-style inline assembly.
llvm-svn: 158325
2012-06-11 20:47:18 +00:00
Argyrios Kyrtzidis 091b87bb9d [libclang] When doing the cursor visitation make sure declarations
in the same line do not override getting a cursor for the previous declaration.

e.g:

int x, y;
@synthesize prop1, prop2;

pointing at 'x'/'prop1' would give 'y'/'prop2' because their source ranges overlap.

rdar://11361113

llvm-svn: 158258
2012-06-09 03:03:02 +00:00
Argyrios Kyrtzidis 1416e17c89 [libclang] Don't crash when saving a PCH from a prefix header
that does not exist.

rdar://11607033

llvm-svn: 158193
2012-06-08 05:48:06 +00:00
Argyrios Kyrtzidis 31afb956ae [libclang/AST]
AST: For auto-synthesized ivars give them the location of the related
property (previously they had no source location). This allows them
to be indexed by libclang.

libclang: Make sure synthesized ivars are indexed before the methods that
may reference them.

Fixes rdar://11607001.

llvm-svn: 158189
2012-06-08 02:16:11 +00:00
Benjamin Kramer 6003ad5848 Plug a long standing memory leak in TemplateArgument.
The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

llvm-svn: 158150
2012-06-07 15:09:51 +00:00
Francois Pichet b27ea02784 Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.
Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

llvm-svn: 158063
2012-06-06 12:00:10 +00:00
Jordan Rose 4214f605f7 [diagtool] Properly order libraries in Makefile for buildbot.
llvm-svn: 157934
2012-06-04 17:21:14 +00:00
Jordan Rose 2fe20dca2a [diagtool] Re-add show-enabled, minimizing the code pulled in from Frontend.
Now correctly builds with both GNU make and CMake.

llvm-svn: 157932
2012-06-04 16:57:50 +00:00
Jordan Rose 573649eb8b [diagtool] Pull show-enabled back out for now.
Need to figure out how to get Frontend's warning parsing without bringing
in all of Frontend.

llvm-svn: 157847
2012-06-01 22:23:02 +00:00
Jordan Rose 74516bafae [diagtool] Unbork Makefile build.
llvm-svn: 157846
2012-06-01 22:02:18 +00:00
Jordan Rose dbdef881a8 [diagtool] Appease buildbot by adding llvm_unreachable.
llvm-svn: 157843
2012-06-01 21:50:37 +00:00
Jordan Rose d617e06997 [diagtool] Add 'show-enabled', which displays which warnings are enabled.
show-enabled uses the command line you give it to build a CompilerInstance,
so any flags you pass will be processed as if running clang proper.

llvm-svn: 157842
2012-06-01 21:23:17 +00:00
Jordan Rose 8b4fcec988 [diagtool] The driver skips two arguments, not one.
llvm-svn: 157841
2012-06-01 21:23:13 +00:00
Benjamin Kramer 69b5a60d96 Replace some custom hash combines with the standard stuff from DenseMapInfo.
llvm-svn: 157531
2012-05-27 13:28:44 +00:00
Anna Zaks 268f154f48 [analyzer] Loading external plugins with scan-build
Load custom plugins when running scan-build. This is useful when
additional static analysis Checkers must be provided via clang's plugin
interface.

Loading additional plugins can now be done via the scan-build call:
scan-build -load-plugin <plugin.so>

A patch by Thomas Hauth.

llvm-svn: 157452
2012-05-25 01:13:50 +00:00
Ted Kremenek e1e89370f0 New & improved man page attached, now with standard license added.
Plus, a patch for scan-build.  

* mdoc corrections
* slightly more compact output
* same license as scan-build
* DESCRIPTION describes
* Default checkers corrected & explained
* Authors credited

The patch adds support for --help-checkers.  It just lists the default
checkers by recursively invoking "scan-build -h" and looking for the
magic '+' signs.  

Patch by James Lowden!

llvm-svn: 157411
2012-05-24 20:13:47 +00:00
Argyrios Kyrtzidis 03a384ec1f [libclang] Report CXType_ObjCId for 'const id', not CXType_Typedef.
rdar://11357807

llvm-svn: 157356
2012-05-23 23:30:16 +00:00
Argyrios Kyrtzidis a32a095920 [libclang] Properly handle @encode() in RecursiveASTVisitor and traverse
its type source info. Fixes indexing references inside @encode().

llvm-svn: 156936
2012-05-16 19:22:47 +00:00
Argyrios Kyrtzidis b7e4367fef [libclang/AST] Index references of protocols in "@protocol(...)" syntax.
To do that, keep track of the location of the protocol id in the ObjCProtocolExpr
AST node.

rdar://11190837

llvm-svn: 156890
2012-05-16 00:50:02 +00:00
Douglas Gregor 4b5c9979b9 Add the output of "clang --version" to scan-build results, from Gerald Combs!
llvm-svn: 156834
2012-05-15 18:41:55 +00:00
Jim Grosbach 490950a928 Allow MCCodeEmitter access to the target MCRegisterInfo.
Add MRI to the createMCCodeEmitter() call.

llvm-svn: 156830
2012-05-15 17:36:07 +00:00
Manuel Klimek 4fa6b60ced This patch fixes the cmake build to create libclang.so/libclang.a on linux
instead of liblibclang.so/liblibclang.a.

Patch by Arnaud de Grandmaison.

llvm-svn: 156809
2012-05-15 08:58:48 +00:00
Ted Kremenek 42c8f73f93 Provide a man page for scan-build. Patch by James Lowden!
llvm-svn: 156559
2012-05-10 19:10:47 +00:00
Argyrios Kyrtzidis b16ff5d1ce Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

llvm-svn: 156536
2012-05-10 05:03:45 +00:00
Argyrios Kyrtzidis 08f96a9b5e [AST/libclang] Speed up clang_getOverriddenCursors() considerably by reserving a bit
in ObjCMethodDecl to indicate whether the method does not override any other method,
which is the majority of cases.

That way we can avoid unnecessary work doing lookups, especially when PCH is involved.

rdar://11360082

llvm-svn: 156476
2012-05-09 16:12:57 +00:00
Argyrios Kyrtzidis d6560a6384 [libclang] Map 'id'/'Class'/'SEL' to the corresponding CXType kinds.
rdar://11357807

llvm-svn: 156352
2012-05-08 01:22:12 +00:00
Douglas Gregor d6225d304e Introduce a new libclang API to determine the platform availability of
a given entity, so that we can tell when the entity was
introduced/deprecated/obsoleted on each platform for which we have an
annotation. Addresses <rdar://problem/11365715>.

llvm-svn: 156347
2012-05-08 00:14:45 +00:00
Argyrios Kyrtzidis 51d6c42824 [libclang] Actually commit the changes to make libclang's RecursiveASTVisitor
data-recursive for statements.

llvm-svn: 156339
2012-05-07 23:23:03 +00:00
Argyrios Kyrtzidis 0c7708b571 [libclang] Put the RecursiveASTVisitor in libclang in a cxindex namespace.
llvm-svn: 156331
2012-05-07 22:22:58 +00:00
Argyrios Kyrtzidis 93e1d1c9e0 Un-revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr".
It was reverted on r156253.

llvm-svn: 156330
2012-05-07 22:16:49 +00:00
Argyrios Kyrtzidis c893ba465e [libclang] Use a copy of the data-recursive RecursiveASTVisitor inside libclang.
This is temporary until we settle on how to make the main RecursiveASTVisitor safe.
There are some modifications on the original version, to avoid extreme memory usage
when compiling for release.

rdar://11179167

llvm-svn: 156329
2012-05-07 22:16:46 +00:00
NAKAMURA Takumi 6fa8719913 Revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which"
It caused test/Index/index-many-call-ops.cpp to fail in stage2 c-index-test on selfhosting i686-cygwin and x86_64-linux since r156229 (Reverting making RecursiveASTVisitor data recursive).

llvm-svn: 156253
2012-05-06 08:24:34 +00:00
Argyrios Kyrtzidis 90c337a23c [libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which
was removed in r155969 to address a deficiency of RecursiveASTVisitor
prior to recent changes on it.

llvm-svn: 156142
2012-05-04 01:00:38 +00:00
Richard Smith 7cbeaba05c Unrevert r155951, reverted in r155962, with two changes:
* Work around build failures due to gcc 4.2 bugs.
 * Remove BodyIndexer::TraverseCXXOperatorCallExpr, which was not being called
   prior to this change, and whose presence disables a RecursiveASTVisitor
   stack space optimization after this change.

llvm-svn: 155969
2012-05-02 00:30:48 +00:00
James Molloy a3c85b8629 Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.
Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/

llvm-svn: 155916
2012-05-01 14:57:16 +00:00
Douglas Gregor 3e653b3628 clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.
llvm-svn: 155858
2012-04-30 23:41:16 +00:00
Ted Kremenek b47610a073 Fix C versus C++ linkage issue.
llvm-svn: 155842
2012-04-30 19:33:45 +00:00
Ted Kremenek d77f6219de Reduce malloc() traffic of clang_getOverridenCursors() by using a pool of SmallVector<CXCursor> objects
under the covers.

Fixes <rdar://problem/11289160>.

llvm-svn: 155841
2012-04-30 19:06:49 +00:00
Chris Lattner 7073c47dc4 don't use soname on OpenBSD, it doesn't support it. Patch by
Brad Smith!

llvm-svn: 155534
2012-04-25 06:09:30 +00:00
Argyrios Kyrtzidis 19d09d23ac [libclang] Don't set dylib load address to 0xe000000.
Per Greg Clayton:
libclang.dylib is trying to be smart and load itself at a valid address
to be able to load faster which would work for 32 bit systems,
bit won't make any difference on 64 bit systems.
It should either pick a better 64 bit address, or just let itself be loaded at zero.

rdar://11159142

llvm-svn: 155246
2012-04-20 22:07:11 +00:00
Chad Rosier 681e4b8d96 Add a little hack to emulate a clang crash, so the diagnostics generator can be
tested.

llvm-svn: 155205
2012-04-20 17:08:59 +00:00
Patrick Beard 0caa39474b Implements boxed expressions for Objective-C. <rdar://problem/10194391>
llvm-svn: 155082
2012-04-19 00:25:12 +00:00
Manuel Klimek ff26efceb4 Adds a FixedCompilationDatabase to be able to specify tool parameters
at the command line.

llvm-svn: 154989
2012-04-18 07:41:50 +00:00
Argyrios Kyrtzidis 17dddd21f5 [libclang] Make sure that when we have multiple @class references in the same line,
that later ones do not override the previous ones.

If we have:
   @class Foo, Bar;
source ranges for both start at '@', so 'Bar' will end up overriding
'Foo' even though the cursor location was at 'Foo'.

rdar://11257578

llvm-svn: 154873
2012-04-16 22:42:01 +00:00
Argyrios Kyrtzidis 365cfb4d1e [libclang] Spelling range for a objc category should the category name range, not the class one.
rdar://11249386

llvm-svn: 154853
2012-04-16 20:01:28 +00:00
Sylvestre Ledru 21a3f764c7 Like for LLVM / shlib, we also provide a SONAME to libclang.so
llvm-svn: 154779
2012-04-15 23:17:25 +00:00
Anna Zaks d682741136 [analyzer] Add .cxx and .txx as known file extensions to ccc-analyzer.
A patch by Sean McBride.

llvm-svn: 154751
2012-04-14 16:30:00 +00:00
Benjamin Kramer af7ae314db c-index-test: dispose spelling string after use.
llvm-svn: 154738
2012-04-14 09:11:51 +00:00
Richard Smith c202b2809a Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.

Patch by Alexander Kornienko!

llvm-svn: 154723
2012-04-14 00:33:13 +00:00
Douglas Gregor 1840cc2cc6 Kill the last vestiges of clangIndex
llvm-svn: 154675
2012-04-13 17:26:32 +00:00
Erik Verbruggen 6e92251f9b Added a flag to the parser to skip method bodies.
llvm-svn: 154584
2012-04-12 10:11:59 +00:00
Ted Kremenek 26a6d498ee Implement clang_getDiagnosticCategoryText() to provide a way for a client of libclang to accurately
get the diagnostic category name from a serialized diagnostic when the version of libclang used
to read the diagnostic file is newer than the clang that emitted the diagnostic file.

llvm-svn: 154567
2012-04-12 00:03:31 +00:00
Argyrios Kyrtzidis 088041721f [libclang] Apparently it's important to build in C89, sigh..
llvm-svn: 154525
2012-04-11 19:54:09 +00:00
Argyrios Kyrtzidis 0c27e4b36b [libclang] Introduce a couple of functions to make it convenient
to get at the parameters (and their types) of a function or objc method cursor.

int clang_Cursor_getNumArguments(CXCursor C);
CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);

rdar://11201527

llvm-svn: 154523
2012-04-11 19:32:19 +00:00
Argyrios Kyrtzidis 408403c4b5 [libclang] In cxloc::translateSourceRange make sure to handle locations in macro arguments
correctly. clang diagnostics can provide fixits inside a macro argument now.

rdar://11014346

llvm-svn: 154517
2012-04-11 18:15:01 +00:00
Argyrios Kyrtzidis 7a9c91c407 [libclang] Fix "error: conflicts with new declaration with ‘C’ linkage" that gcc
emits but not clang.

llvm-svn: 154475
2012-04-11 03:52:18 +00:00
Argyrios Kyrtzidis ac1cc934b3 [libclang] If displayDiagnostics is set (when calling clang_createIndex), make sure to
output the errors that occurred even if we did not get an AST (e.g. because the
PCH failed to load).

Also honor displayDiagnostics in clang_indexSourceFile().

rdar://11203489

llvm-svn: 154472
2012-04-11 02:11:16 +00:00
Argyrios Kyrtzidis c238f06a2c [libclang] For clang_getOverriddenCursors make sure to report overridden objc methods
for methods in categories of super classes. rdar://11220358

llvm-svn: 154436
2012-04-10 21:01:03 +00:00
Argyrios Kyrtzidis 9d7c0fef65 [code-complete] Introduce CodeCompletionTUInfo which will be used for caching
code-completion related strings specific to a translation unit (ASTContext and related data)

CodeCompletionAllocator does such limited caching, by caching the name assigned
to a DeclContext*, but that is not the appropriate place since that object has
a lifetime that can extend beyond that of an ASTContext.

Introduce CodeCompletionTUInfo which will be always tied to a translation unit
to do this kind of caching and move the caching of CodeCompletionAllocator into this
object, and propagate it to all the places where it will be needed.

The plan is to extend the caching where appropriate, using CodeCompletionTUInfo,
to avoid re-calculating code-completion strings.

Part of rdar://10796159.

llvm-svn: 154408
2012-04-10 17:23:48 +00:00
NAKAMURA Takumi a7d49883bb [Cygwin] Work around to flush stdout in a thread, or stdout in threads won't be flushed at exit.
llvm-svn: 154254
2012-04-07 06:59:28 +00:00
Benjamin Kramer 74875e6719 clangFrontend depends on clangEdit.
llvm-svn: 154010
2012-04-04 12:25:11 +00:00
Manuel Klimek 47c245a537 Adds a tooling library.
Provides an API to run clang tools (FrontendActions) as standalone tools,
or repeatedly in-memory in a process. This is useful for unit-testing,
map-reduce style applications, source transformation daemons or command line
tools.

The ability to run over multiple translation units with different command
line arguments enables building up refactoring tools that need to apply
transformations across translation unit boundaries.

See tools/clang-check/ClangCheck.cpp for an example.

llvm-svn: 154008
2012-04-04 12:07:46 +00:00
Ted Kremenek 34b4546c06 Fix dead store warning.
llvm-svn: 153988
2012-04-04 00:55:33 +00:00