aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang
AgeCommit message (Collapse)Author
2010-11-16Rework USR generation from CXCursors to use CXStringBufsTed Kremenek
for the backing of generated USRs. This optmizes for the case when a client generates a sequence of USRs in sequence, disposing of them soon after generating them. By using a string buffer, we recycle malloc'ed memory instead of constantly malloc'ing and copying strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Change CXTranslationUnit to not directly cast to an ASTUnit*,Ted Kremenek
but to wrap both an ASTUnit and a "string pool" that will be used for fast USR generation. This requires a bunch of mechanical changes, as there was a ton of code that assumed that CXTranslationUnit and ASTUnit* were the same. Along with this change, introduce CXStringBuf, which provides an llvm::SmallVector<char> backing for repeatedly generating CXStrings without a huge amount of malloc() traffic. This requires making some changes to the representation of CXString by renaming a few fields (but keeping the size of the object the same). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119337 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Add CXString.cpp and CXString.hTed Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119322 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Move CXString creation/management routines intoTed Kremenek
their own .cpp file and make the interpretation of its flags private. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15CursorVisitor: cache worklists created for data-recursion to reduce malloc() ↵Ted Kremenek
traffic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119290 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall
certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Use LLVM_ATTRIBUTE_NOINLINE instead of attribute((noinline)).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119287 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Cast pointers instead of returning a new value within RunVisitorWorkList().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Annotate CursorVisitor::VisitDataRecursive() with attribute 'noinline'.Ted Kremenek
Clang currently uses a ridiculous amount of stack space when inlining this function, which can lead to premature stack overflows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14"Fix" some unintentional fallout from convertingTed Kremenek
the Stmt* visitation in CursorVisitor to be data-recursive. Since AnnotationTokensWorker explicitly calls CursorVisitor::VisitChildren(), it essentially transforms the data-recursive algorithm in CursorVisitor back into a non-data recursive one. This is particularly bad because the data-recursive algorithm uses more stack space per stack frame, which can cause us to blow the stack in some cases. "Fix" this by making the stack that AnnotationTokensWorker runs in really huge. The real fix is to modify AnnotationTokensWorker not to do the explicit recursive call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14CursorVisitor: make data-recursion algorithm the default except for the few ↵Ted Kremenek
remaining Exprs still covered by the normal recursive visitation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14Remove stale #include.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13Rewrite reverse iteration loop in a more natural countdown manner.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: migrate CXXNewExpr and CXXDefaultArgExpr over to ↵Ted Kremenek
data-recursive algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: special-case CompoundStmt in data-recursion algorithm so we ↵Ted Kremenek
don't have to enqueue its children and then reverse them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118986 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: Migrate BlockExpr, CXXTemporaryOBjectExpr, and ObjCEncodeExpr ↵Ted Kremenek
to data-recursive algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: Migrate DeclRefExpr over to data-recursion algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118961 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: migrate GotoStmt to data-recursive algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: migrate DeclStmt over to data-recursive algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13CursorVisitor: Convert logic for populating data-recursion worklist from a ↵Ted Kremenek
switch statement to a StmtVisitor. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12Use dyn_cast result instead of re-casting. Fixes -Werror build with:Nick Lewycky
/llvm/tools/clang/tools/libclang/CIndex.cpp:1823: error: unused variable 'E' [-Wunused-variable] git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: Pull ObjCMessageExpr and explicit casts into data-recursion ↵Ted Kremenek
algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate ObjCMessageExpr over to data-recursion algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate UnresolvedMemberExpr and UnresolvedLookupExpr over to ↵Ted Kremenek
data-recursion algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate CompoundLiteralExpr over to data-recursion algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: add data-recursion support for InitListExprs.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate 'DoStmt', 'ForStmt', and 'WhileStmt' over to ↵Ted Kremenek
data-recursion algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118912 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: use 'WLAddStmt' and 'WLAddDecl' for adding to data-recursion ↵Ted Kremenek
worklist. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate 'IfStmt' over to data-recursive algorithm.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118910 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12CursorVisitor: migrate handling of SwitchStmt and CaseStmt over to general ↵Ted Kremenek
data-recursion algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12Make sure to always check the result ofDouglas Gregor
SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11Modify CursorVisitor to also walks CXXOperatorCallExprs using ↵Ted Kremenek
data-recursion. Fixes <rdar://problem/8659019>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11Annotate tokens in a separate thread to avoid blowing out stack space. ↵Ted Kremenek
While the CursorVisitor is gradually becoming more data recursive, AnnotateTokensVisitor does its own recursive call within the visitor that can still blow out the stack. This can potentially be reworked to avoid this, but for now just do token annotation on a separate thread. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11Generalize data-recursive visitation in CursorVisitor to also handle MemberExprsTed Kremenek
and CXXCallMemberExprs. This scheme is hopefully general enough to extend to the rest of the visitor if necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11Improve ASTUnit's capture of diagnostics so that theDouglas Gregor
diagnostic-capturing client lives as long as the ASTUnit itself does. Otherwise, we can end up with crashes when we get a diagnostic outside of parsing/code completion. The circumstances under which this happen are really hard to reproduce, because a file needs to change from under us. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10Replace UsingDecl's SmallPtrSet of UsingShadowDecls with a linked list to ↵Argyrios Kyrtzidis
avoid leaking memory. Fixes rdar://8649963. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118674 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09ntroduce clang_getSpellingLocation() into libclang, to provide theDouglas Gregor
location where we're spelling a token even within a macro. clang_getInstantiationLocation() tells where we instantiated the macro. I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs, since they gloss over macro-instantiation information. Take 2: this time, adjusted tests appropriately and used a "simple" approach to the spelling location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09Revert r118492, which didn't update all of its tests accordinglyDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118494 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09Introduce clang_getSpellingLocation() into libclang, to provide theDouglas Gregor
location where we're spelling a token even within a macro. clang_getInstantiationLocation() tells where we instantiated the macro. I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs, since they gloss over macro-instantiation information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09c-index-test: Be available on Cygwin by using Win32's logic.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08Add CursorVisitor::VisitBinaryOperator() to explicitly handle the case where ↵Ted Kremenek
we can blow out the stack due to deeply nested BinaryOperators. This is done by turning the explicit recursion into being data recursive. Fixes: <rdar://problem/8289205> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-07Remove broken support for variadic templates, along with the variousDouglas Gregor
abstractions (e.g., TemplateArgumentListBuilder) that were designed to support variadic templates. Only a few remnants of variadic templates remain, in the parser (parsing template type parameter packs), AST (template type parameter pack bits and TemplateArgument::Pack), and Sema; these are expected to be used in a future implementation of variadic templates. But don't get too excited about that happening now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05Teach clang_getCursorReferenced() that aDouglas Gregor
CXXConstructorExpr/CXXTemporaryObjectExpr references the constructor it calls. Then, tweak clang_getCursor() to prefer such a call over a type reference to the type being called. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05libclang: Enable requesting a larger stack for several libclang entry pointsDaniel Dunbar
using "safety" threads. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05libclang: Add some support for running certain entry points in a "safety"Daniel Dunbar
thread, primarily to get a larger stack. - Yes, I feel dirty. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05Fix 80-col violas.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04libclang: Add clang_executeOnThread, for use in c-index-test (and only there,Daniel Dunbar
preferably). Good thing c-index-test is written in C!!!! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03Implement -working-directory.Argyrios Kyrtzidis
When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03Added cursor visitor that takes a block as an argument. Tested compilingDavid Chisnall
libclang with both clang -fblocks and gcc (no blocks support). Only exposed in the header to compilers that do have blocks support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03Improve source-location information for CXXConstructExpr nodes, byDouglas Gregor
ensuring that they cover all of their child nodes. There's still a clang_getCursor()-related issue with CXXFunctionalCastExprs with CXXConstructExprs as children (see FIXME in the test case); I'll look at that separately. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118132 91177308-0d34-0410-b5e6-96231b3b80d8