[cfe-dev] Adding more analysis algorithms to Clang?

Guoping Long longguoping at gmail.com
Sat Oct 22 13:31:28 PDT 2011


Hi,

   Attached is the re-generated patch using PostOrderCFGView.

--
Guoping

2011/10/21 Chandler Carruth <chandlerc at google.com>

> On Fri, Oct 21, 2011 at 10:39 PM, Guoping Long <longguoping at gmail.com>wrote:
>
>> Hi, Ted
>>
>>    After I update from the svn, the source tree can not be compiled (so I
>> can not test the new code using PostOrderCFGView). I only updated Clang. Do
>> I still need to update llvm?
>>
>
> Yes, this represents an API shift. Clang and LLVM must always be updated in
> sync.
>
>
>>  Here is the error message:
>> /Users/gplong/llvm-test/tools/clang/tools/driver/cc1as_main.cpp:298:44:
>> error: too many arguments to function call, expected 9, have 10
>>                                            Opts.ShowInst));
>>                                            ^~~~~~~~~~~~~
>> /Users/gplong/llvm-test/include/llvm/Support/TargetRegistry.h:424:5: note:
>> 'createAsmStreamer' declared here
>>     MCStreamer *createAsmStreamer(MCContext &Ctx,
>>     ^
>> 1 error generated.
>>
>> ------
>> Guoping
>>
>> 2011/10/21 Ted Kremenek <kremenek at apple.com>
>>
>>> Hi Guoping,
>>>
>>> I've added PostOrderCFGView.  Can you regenerate your patch using this
>>> class?
>>>
>>> Cheers,
>>> Ted
>>>
>>>
>>> On Oct 21, 2011, at 10:25 AM, Guoping Long wrote:
>>>
>>> Hi, Ted
>>>
>>>   TopologicallySortedCFG implements a post ordering of all CFG nodes.
>>> Maybe renaming it into POSortedCFG is better. Similarly, some algorithms may
>>> need something like pre-ordered CFG. I believe more analysis algorithms may
>>> need either of these. It may be nice to have such a class as an basic
>>> functionality in the infrastructure. Analysis algorithms will just *use*
>>> this basic functionality, rather than implement/copy-paste such classes in a
>>> somewhat ad-hoc way.
>>>
>>> ----
>>> Guoping
>>>
>>> 2011/10/21 Ted Kremenek <kremenek at apple.com>
>>>
>>>> Hi Guoping,
>>>>
>>>> This looks great to me.  My main concern is that we are
>>>> copy-pasting TopologicallySortedCFG and CFGBlockSet yet again.  This is a
>>>> very bad trend.  Before this patch goes in, I'd like to see that common code
>>>> refactored.  I'll look into fixing that today.
>>>>
>>>> Cheers,
>>>> Ted
>>>>
>>>> On Oct 20, 2011, at 11:57 AM, Guoping Long wrote:
>>>>
>>>> Hi
>>>>
>>>>    Thanks Anna. Thanks for all who help point issues in my code!
>>>>
>>>>     The FileCheck logic has been added. Now I believe the code is at
>>>> least in a reasonable shape. Attached is the revised patch.  Please let me
>>>> know if there are additional issues. I shall fix them.
>>>>
>>>> ----
>>>> Guoping
>>>>
>>>> 2011/10/18 Anna Zaks <ganna at apple.com>
>>>>
>>>>> Hi Guoping,
>>>>>
>>>>> To automate testing, you should check the expected output of the
>>>>> dominators analysis checker with FileCheck. Inside the test, you specify the
>>>>> command which should be applied on it as well as the expected output. It
>>>>> will get tested when you run the following from the clang build directory
>>>>> (see the Testing section on http://clang.llvm.org/hacking.html):
>>>>> $ make test
>>>>> or if you only want to test the tests from the analysis folder:
>>>>> $ TESTDIRS=Analysis make test
>>>>>
>>>>> Your test is probably going to look similar to the following example,
>>>>> which tests CFG builder:
>>>>> test/Analysis/initializers-cfg-output.cpp
>>>>>
>>>>> You can find the documentation on FileCheck here:
>>>>> http://llvm.org/docs/TestingGuide.html The document might be a bit
>>>>> outdated but it does a good job explaining the concepts.
>>>>>
>>>>> Cheers,
>>>>> Anna.
>>>>> On Oct 18, 2011, at 9:08 AM, Guoping Long wrote:
>>>>>
>>>>> Hi, clang
>>>>>
>>>>>   Thanks Joerg and Arash. Attached is the new patch with everything
>>>>> contained.  Please let me know if there are any further issues. I shall
>>>>> continue working to improve it.
>>>>>
>>>>> --Guoping
>>>>>
>>>>> 2011/10/18 Joerg Sonnenberger <joerg at britannica.bec.de>
>>>>>
>>>>>> On Mon, Oct 17, 2011 at 10:59:27PM -0700, Guoping Long wrote:
>>>>>> > 1 The patch file is generated by running svn diff under the
>>>>>> llvm/tools/clang
>>>>>> > directory. I do not know why this patch only contains information
>>>>>> for
>>>>>> > existing file modifications, not including new added files
>>>>>> (dominators.cpp
>>>>>> > (should be in clang/lib/Analysis/), dominators.h (should be in
>>>>>> > clang/include/clang/Analysis/Analyses/), domtest.c (should be in
>>>>>> > clang/test/Analysis)). So I included the patch in together with the
>>>>>> three
>>>>>> > new files as attached.
>>>>>>
>>>>>> Did you run "svn add" on them first?
>>>>>>
>>>>>> Joerg
>>>>>>
>>>>>
>>>>> <dominators.patch>_______________________________________________
>>>>>
>>>>> cfe-dev mailing list
>>>>> cfe-dev at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>>
>>>>>
>>>>>
>>>> <dominators.patch>_______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>
>>>>
>>>>
>>>
>>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111022/ff4ab5c5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dominators.patch
Type: application/octet-stream
Size: 12998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111022/ff4ab5c5/attachment.obj>


More information about the cfe-dev mailing list