summaryrefslogtreecommitdiff
path: root/include/clang/Index
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Index')
-rw-r--r--include/clang/Index/IndexDataConsumer.h5
-rw-r--r--include/clang/Index/IndexSymbol.h6
-rw-r--r--include/clang/Index/IndexingAction.h11
-rw-r--r--include/clang/Index/USRGeneration.h27
4 files changed, 42 insertions, 7 deletions
diff --git a/include/clang/Index/IndexDataConsumer.h b/include/clang/Index/IndexDataConsumer.h
index 6e11455661a09..c79f6be3e13bf 100644
--- a/include/clang/Index/IndexDataConsumer.h
+++ b/include/clang/Index/IndexDataConsumer.h
@@ -50,7 +50,12 @@ public:
SourceLocation Loc);
/// \returns true to continue indexing, or false to abort.
+ ///
+ /// This will be called for each module reference in an import decl.
+ /// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the
+ /// 'reference' role, and a call for 'SubMod' with the 'declaration' role.
virtual bool handleModuleOccurence(const ImportDecl *ImportD,
+ const Module *Mod,
SymbolRoleSet Roles, SourceLocation Loc);
virtual void finish() {}
diff --git a/include/clang/Index/IndexSymbol.h b/include/clang/Index/IndexSymbol.h
index 068796141df8b..8aaaa695456c4 100644
--- a/include/clang/Index/IndexSymbol.h
+++ b/include/clang/Index/IndexSymbol.h
@@ -75,7 +75,7 @@ enum class SymbolSubKind : uint8_t {
UsingValue,
};
-typedef uint8_t SymbolPropertySet;
+typedef uint16_t SymbolPropertySet;
/// Set of properties that provide additional info about a symbol.
enum class SymbolProperty : SymbolPropertySet {
Generic = 1 << 0,
@@ -86,8 +86,10 @@ enum class SymbolProperty : SymbolPropertySet {
IBOutletCollection = 1 << 5,
GKInspectable = 1 << 6,
Local = 1 << 7,
+ /// Symbol is part of a protocol interface.
+ ProtocolInterface = 1 << 8,
};
-static const unsigned SymbolPropertyBitNum = 8;
+static const unsigned SymbolPropertyBitNum = 9;
/// Set of roles that are attributed to symbol occurrences.
///
diff --git a/include/clang/Index/IndexingAction.h b/include/clang/Index/IndexingAction.h
index 0d09c403483d9..63e38975ce169 100644
--- a/include/clang/Index/IndexingAction.h
+++ b/include/clang/Index/IndexingAction.h
@@ -12,6 +12,7 @@
#include "clang/Basic/LLVM.h"
#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/ArrayRef.h"
#include <memory>
@@ -40,6 +41,10 @@ struct IndexingOptions {
= SystemSymbolFilterKind::DeclarationsOnly;
bool IndexFunctionLocals = false;
bool IndexImplicitInstantiation = false;
+ // Whether to index macro definitions in the Preprocesor when preprocessor
+ // callback is not available (e.g. after parsing has finished). Note that
+ // macro references are not available in Proprocessor.
+ bool IndexMacrosInPreprocessor = false;
};
/// Creates a frontend action that indexes all symbols (macros and AST decls).
@@ -50,13 +55,12 @@ createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
std::unique_ptr<FrontendAction> WrappedAction);
/// Recursively indexes all decls in the AST.
-/// Note that this does not index macros.
void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
IndexingOptions Opts);
/// Recursively indexes \p Decls.
-/// Note that this does not index macros.
-void indexTopLevelDecls(ASTContext &Ctx, ArrayRef<const Decl *> Decls,
+void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP,
+ ArrayRef<const Decl *> Decls,
IndexDataConsumer &DataConsumer, IndexingOptions Opts);
/// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
@@ -65,7 +69,6 @@ std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
IndexingOptions Opts);
/// Recursively indexes all top-level decls in the module.
-/// FIXME: make this index macros as well.
void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
IndexDataConsumer &DataConsumer, IndexingOptions Opts);
diff --git a/include/clang/Index/USRGeneration.h b/include/clang/Index/USRGeneration.h
index 1ece321746a60..f1389ecc9593b 100644
--- a/include/clang/Index/USRGeneration.h
+++ b/include/clang/Index/USRGeneration.h
@@ -14,10 +14,13 @@
#include "llvm/ADT/StringRef.h"
namespace clang {
+class ASTContext;
class Decl;
class MacroDefinitionRecord;
+class Module;
class SourceLocation;
class SourceManager;
+class QualType;
namespace index {
@@ -70,8 +73,30 @@ bool generateUSRForMacro(const MacroDefinitionRecord *MD,
bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
const SourceManager &SM, SmallVectorImpl<char> &Buf);
+/// Generates a USR for a type.
+///
+/// \return true on error, false on success.
+bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl<char> &Buf);
+
+/// Generate a USR for a module, including the USR prefix.
+/// \returns true on error, false on success.
+bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS);
+
+/// Generate a USR for a top-level module name, including the USR prefix.
+/// \returns true on error, false on success.
+bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS);
+
+/// Generate a USR fragment for a module.
+/// \returns true on error, false on success.
+bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS);
+
+/// Generate a USR fragment for a module name.
+/// \returns true on error, false on success.
+bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS);
+
+
} // namespace index
} // namespace clang
-#endif // LLVM_CLANG_IDE_USRGENERATION_H
+#endif // LLVM_CLANG_INDEX_USRGENERATION_H