Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Last active October 16, 2022 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trass3r/a96d51cf1b3bfa44d66a90d0b0c3c7b4 to your computer and use it in GitHub Desktop.
Save Trass3r/a96d51cf1b3bfa44d66a90d0b0c3c7b4 to your computer and use it in GitHub Desktop.
export PATH="/c/Program Files/LLVM/bin":$PATH
find include/llvm/IR -name '*.h' | xargs clang-query -p objdir
clang-query -p objdir include\llvm\IR\Value.h include\llvm\IR\Use.h include\llvm\Analysis\CallGraph.h
clang-query -p objdir include\llvm\ADT\SmallVector.h
vs
clang-query -p objdir include\llvm\Support\Allocator.h
m cxxRecordDecl(hasDefinition().bind("d"), hasExternalFormalLinkage(), unless(anyOf(isExpansionInSystemHeader(), isExplicitTemplateSpecialization(), hasParent(classTemplateDecl()), hasParent(classTemplateSpecializationDecl()))))
m cxxRecordDecl(hasExternalFormalLinkage(), isClass(), unless(isExpansionInSystemHeader()), hasAncestor(namespaceDecl(isAnonymous()).bind("ns")))
l getClass hasParent(cxxRecordDecl().bind("class"))
m cxxMethodDecl(nosys, unless(isDefinition()), getClass)
l isnllvm unless(isllvm)
l extsym hasExternalFormalLinkage()
l isllvm hasAncestor(namespaceDecl(hasName("llvm")))
l nosys unless(isExpansionInSystemHeader())
l hasM hasDescendant(cxxMethodDecl(unless(isEffectivelyInline())).bind("method"))
l hasD has(varDecl(isDefinition()).bind("var"))
m cxxRecordDecl(nosys, hasD, isllvm)
m cxxRecordDecl(nosys, anyOf(hasM, hasD), isllvm)
N=4
(
for D in include/llvm/S*/
do
((i=i%N)); ((i++==0)) && wait
FOLDER=`basename $D`
find $D -name '*.h' | xargs -t objdir/bin/clang-tidy.exe -fix-errors -p objdir -checks=-*,performance-symbol-export -config="{CheckOptions: [{key: performance-symbol-export.exportMacro, value: LLVM${FOLDER^^}_EXPORT}, {key: performance-symbol-export.exportHdr, value: llvm${FOLDER,,}_export.h}]}" -export-fixes="test$FOLDER.yaml" &
# -header-filter=.*
done
)
class Class
{
void inlineMethod() {}
void outoflineMethod();
template <typename T>
void inlineTemplateMethod() {};
template <typename T>
void outoflineTemplateMethod();
static const char staticConstDataDecl;
static const char staticConstDataDef = 0;
static void outoflineStaticMethodDecl();
static void inlineStaticMethodDef() {}
private:
static char staticData;
};
template <typename T>
void Class::outoflineTemplateMethod()
{
}
struct Base
{
virtual ~Base() = default;
virtual void virtualMethod() = 0;
virtual void virtualMethod2() = 0;
};
class Derived final : public Base
{
void virtualMethod() override {}
void virtualMethod2() override;
};
class DerivedInline final : public Base
{
void virtualMethod() override {}
void virtualMethod2() override {}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment