Commit Graph

490 Commits

Author SHA1 Message Date
Daniel Dunbar 4cd55b0507 Don't install wpa or index-test tools.
llvm-svn: 79557
2009-08-20 18:45:52 +00:00
Nate Begeman 5ec4b318e3 Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.

llvm-svn: 78621
2009-08-10 23:49:36 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Daniel Dunbar 71f22e738a Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
      'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--

Yay!

I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.

llvm-svn: 78554
2009-08-10 03:40:28 +00:00
Daniel Dunbar 481fe50903 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp

llvm-svn: 78551
2009-08-10 03:01:36 +00:00
Nate Begeman a96114ed08 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.

llvm-svn: 78535
2009-08-09 17:55:44 +00:00
Benjamin Kramer 8b79886e0d Remove duplicated colon.
llvm-svn: 77891
2009-08-02 12:12:11 +00:00
Mike Stump 183c3d2f59 Add beginnigs of rtti generation, wire up more of -fno-exceptions.
llvm-svn: 77751
2009-07-31 23:15:31 +00:00
Argyrios Kyrtzidis bd92767014 Add support for ObjC message expressions, in the Analyzer:
-Accept an ObjC method and find all message expressions that this method may respond to.
-Accept an ObjC message expression and find all methods that may respond to it.

llvm-svn: 77551
2009-07-30 00:03:55 +00:00
Argyrios Kyrtzidis 2eff90515f Support ObjC methods as Entities.
llvm-svn: 77547
2009-07-29 23:41:46 +00:00
Argyrios Kyrtzidis f7f56741e0 Add TranslationUnit::getSelectorMap().
llvm-svn: 77542
2009-07-29 23:41:08 +00:00
Argyrios Kyrtzidis 91d3df0b53 -Introduce the idx::Analyzer class used for getting indexing information, like finding
references of a declaration across translation units.

-Modify the index-test tool to use it.

llvm-svn: 77536
2009-07-29 23:40:14 +00:00
Argyrios Kyrtzidis 82150b38d2 Add getDeclReferenceMap() to the abstract interface of TranslationUnit class.
llvm-svn: 77530
2009-07-29 23:39:18 +00:00
Argyrios Kyrtzidis ca9efa0271 Remove the TranslationUnit usage from clang-wpa.cpp since it's not really
necessary.

llvm-svn: 77529
2009-07-29 23:39:09 +00:00
Argyrios Kyrtzidis f1a0fd852f Introduce a helper template for the Handler classes and use it instead
of the iterator of the Indexer class.

llvm-svn: 77528
2009-07-29 23:39:03 +00:00
Argyrios Kyrtzidis dd9ee4aa04 -Make IndexProvider an abstract interface for getting indexing information.
-Introduce Indexer as an IndexProvider implementation.

llvm-svn: 77524
2009-07-29 23:38:21 +00:00
Daniel Dunbar 13796e3b95 Destroy the ASTConsumer prior to the Context, HTMLPrinter for example wants to
do a significant amount of work in its destructor, which may access the
context. (PR4642).

llvm-svn: 77423
2009-07-29 02:40:09 +00:00
Zhongxing Xu ee5d708e55 Add two nodes to the call graph:
- Root is the main function or 0.
 - ExternalCallingNode has edges to all external functions.

llvm-svn: 76876
2009-07-23 13:39:38 +00:00
Argyrios Kyrtzidis 05ac8276cf Change the semantics for Entity.
Entity can now refer to declarations that are not visible outside the translation unit.
It is a wrapper of a pointer union, it's either a Decl* for declarations that don't
"cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl.

Included is a test case for handling fields across translation units.

llvm-svn: 76515
2009-07-21 00:07:06 +00:00
Argyrios Kyrtzidis 153d418def Add '\n' to the end of error message.
llvm-svn: 76506
2009-07-21 00:05:10 +00:00
Argyrios Kyrtzidis d6bf03c272 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis 05898da9cb Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
llvm-svn: 76298
2009-07-18 08:50:35 +00:00
Daniel Dunbar c3ccd180e7 Fix indentation / trailing white space.
llvm-svn: 76200
2009-07-17 18:10:27 +00:00
Daniel Dunbar 54091b82b5 [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.

llvm-svn: 76107
2009-07-16 21:32:51 +00:00
Ted Kremenek afe797d7b3 Add 'clang-wpa' to the CMake-based build.
llvm-svn: 76091
2009-07-16 18:10:20 +00:00
Daniel Dunbar 84a56054cd Unbreak build?
llvm-svn: 75887
2009-07-16 02:02:48 +00:00
Zhongxing Xu cd64aaa4a9 update makefile.
llvm-svn: 75878
2009-07-16 01:05:34 +00:00
Zhongxing Xu bd8549169a add copyright comments.
llvm-svn: 75877
2009-07-16 01:03:49 +00:00
Zhongxing Xu 17c9e7cb5c Add a primitive clang whole primitive analyzer tool.
llvm-svn: 75874
2009-07-16 01:00:25 +00:00
Owen Anderson 9f98d37612 Update for LLVM API change.
llvm-svn: 75869
2009-07-16 00:14:12 +00:00
Dan Gohman 74e3eb49ea Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.

llvm-svn: 75802
2009-07-15 17:32:18 +00:00
Argyrios Kyrtzidis 12563b8111 Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis e6cd787ee1 For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
llvm-svn: 75599
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis 2f0eff102c Handle struct fields through the index-test tool.
llvm-svn: 75596
2009-07-14 03:18:40 +00:00
Zhongxing Xu 6999b90146 Fix comment.
llvm-svn: 74896
2009-07-07 07:14:55 +00:00
Douglas Gregor 0086a5a3bb Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.

llvm-svn: 74885
2009-07-07 00:12:59 +00:00
Argyrios Kyrtzidis 85b18aff24 Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
llvm-svn: 74863
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis b8020f0833 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

llvm-svn: 74862
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis f24249554b Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

llvm-svn: 74860
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis 63afa49add Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
llvm-svn: 74859
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis b0048027ba Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

llvm-svn: 74858
2009-07-06 21:34:20 +00:00
Argyrios Kyrtzidis 5641111e3f Make use of the Index library through the index-test tool.
'index-test' is now able to provide additional info for a Decl, through multiple AST files:
-Find declarations
-Find definitions
-Find references

llvm-svn: 74803
2009-07-05 22:22:35 +00:00
Argyrios Kyrtzidis a4d36d5a58 Make use of ASTNode for return value of clang::ResolveLocationInAST() and in the index-test tool.
llvm-svn: 74798
2009-07-05 22:21:40 +00:00
Douglas Gregor c6d5edd2ed Add support for retrieving the Doxygen comment associated with a given
declaration in the AST. 

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment, 
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile). 

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
  - We don't actually attempt to parse the comment blocks themselves,
  beyond identifying them as Doxygen comment blocks to associate them
  with a declaration.
  - We won't find comment blocks that aren't adjacent to the
  declaration, because we start our search based on the location of
  the declaration.
  - We don't go through the necessary hops to find, for example,
  whether some redeclaration of a declaration has comments when our
  current declaration does not. Similarly, we don't attempt to
  associate a \param Foo marker in a function body comment with the
  parameter named Foo (although that is certainly possible).
  - Verification of my "no performance impact" claims is still "to be
  done".

llvm-svn: 74704
2009-07-02 17:08:52 +00:00
Owen Anderson ecaeaa81b1 Update for changes in LLVM. Hopefully this is the last one for a while.
llvm-svn: 74657
2009-07-01 23:14:14 +00:00
Owen Anderson 03200753ee Hold the LLVMContext by reference instead of by pointer.
llvm-svn: 74642
2009-07-01 21:23:16 +00:00
Daniel Dunbar 38bfda6ab5 Driver: Move Compilation::Execute to Driver::ExecuteCompilation.
- The Compilation is just a helper class, it shouldn't have that amount of
   logic in it.

 - No functionality change.

llvm-svn: 74634
2009-07-01 20:03:04 +00:00
Owen Anderson d9dd77ff6c Update for LLVMContext+Module change.
llvm-svn: 74615
2009-07-01 17:00:06 +00:00
Chris Lattner c61089a6c2 Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.
This is simple enough, but then I thought it would be nice to make PrintingPolicy
get a LangOptions so that various things can key off "bool" and "C++" independently.
This spiraled out of control.  There are many fixme's, but I think things are slightly
better than they were before.

One thing that can be improved: CFG should probably have an ASTContext pointer in it,
which would simplify its clients.

llvm-svn: 74493
2009-06-30 01:26:17 +00:00
Argyrios Kyrtzidis 3cfb28a68d Remove redundant leftover code.
llvm-svn: 74433
2009-06-29 17:38:09 +00:00