[llvm-bugs] [Bug 40109] New: Conditions in macros not correctly handled

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 20 02:55:50 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40109

            Bug ID: 40109
           Summary: Conditions in macros not correctly handled
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: steveire at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

#define ASSUME(COND) if (!(COND)) return 0

struct A
{
  int someApi();
};

int testAssert(A* a) {
    if (!(!a))
        return 0;
    return a->someApi();
}

int testAssert3(A* a) {
    ASSUME(!a);
    return a->someApi();
}



$ clang++ --analyze ../tmp/assert.cpp
../tmp/assert.cpp:13:12: warning: Called C++ object pointer is null
    return a->someApi();
           ^~~~~~~~~~~~
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181220/3c2189ee/attachment-0001.html>


More information about the llvm-bugs mailing list