Giter VIP home page Giter VIP logo

odrey-clang's People

Contributors

artalus avatar

Watchers

 avatar  avatar

odrey-clang's Issues

Multithreaded AST traversing

Analyzing bigger compilation database can be potentially sped up by at least traversing separate files in parallel and then appending OdrMap with results.

Check full AST for functions and classes

Current implementation simply compares the text of definitions, instead of their semantic content and underlying types, which doesn't allow detecting cases like these:

using ViolatingAlias = float;
class SubtleViolationClass {
public:
	ViolatingAlias x;
	void fun() { std::cout << x << '\n'; }
};

//b.cpp
using ViolatingAlias = std::string;
class SubtleViolationClass {
public:
	ViolatingAlias x;
	void fun() { std::cout << x << '\n'; }
};

The possible way for comparing statements (function bodies) is present here.
Problem: stored Stmt* pointers invalidate somewhere after clang::ast_matchers::MatchFinder::MatchCallback's void run(const clang::ast_matchers::MatchFinder::MatchResult &result) exit.
Maybe matchers are a wrong approach and I need to switch to other ways of traversing AST.

Fix `stddef.h` and related include errors in runtime

Right now when started not from system path like /bin or /usr/bin, the tool argues that it cannot locate include files stddef.h, stdint.h etc. when parsing system headers like <iostream>. This of course causes mayhem and incorrect behavior.

The issue is related to clang builtin includes. To quote:

the default location to look for builtin headers is in a path $(dirname /path/to/tool)/../lib/clang/3.3/include relative to the tool binary. This works out-of-the-box for tools running from llvm’s toplevel binary directory after building clang-headers, or if the tool is running from the binary directory of a clang install next to the clang binary.

Another clue from pro.cxx

Berkus Decker, [15.03.18 11:09]
it is not /usr/bin, it is clang-install-dir wherever you've installed it, it is considered as root, since that's the way relocatable toolchain is done in LLVM

Another clue.

Once fixed, apply the same to leak-marker.

Detect collisions in user code linked against 3rd-party static lib

class RealisationDetail {
  int x;
  void set(int v) { x = v; }
};

///lib.h
class TotallyOk {};
///lib.a
class ImplementationDetail {
  const char buffer[256];
  void set(const char *str) { ... }
}

...Is this even collision, or would linker be smart enough to separate those? And if it is, are there any options besides emitting ODR-1338: file.cpp: defining symbol X, while lib.a also has symbol X exported?
It also would need some crossplatform readelf or nm to work.

Specify path to system libraries for cross-compile

  • Search for <string> in /arm/target/usr/include instead of /usr/include
  • Prevent clang builtin limits.h #include_nexting /usr/include/limits.h
  • Ensure right primitives' sizeof when targeting different bitness (leading to sizeof(long) != SIZE_OF_LONG)

Clue from #llvm

@filcab [07.05.2018 1:15 PM]
You’ll want to explicitly add the target to your libclang command lines. You might want to add -isysroot too. If all else fails, do what I did for ycm and explicitly add the include paths that your compiler searches (check out the output of a compile with -v)

Can be partially worked around by providing -nostdinc++ -isystem /path/to/usr/include -isystem /path/to/cross-gcc/stdlib in compile_commads.json.

Probably those can be added with a commandline adjuster like the one in clang's CommonOptionsParser.cpp.

Another clue.

Once fixed, apply the same to leak-marker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.