[llvm] r239601 - [ASan] format AddressSanitizer.cpp with `clang-format -style=Google`, NFC

Alexander Potapenko glider at google.com
Fri Jun 12 11:04:49 PDT 2015


Ok, I'll fix the formatting.

sent from phone
On Jun 12, 2015 7:51 PM, "Filipe Cabecinhas" <filcab at gmail.com> wrote:

> It makes no sense to format it using Google style, like Alexey said.
> It would also be a problem when someone else edited the file and used the
> LLVM clang-format style, because that's what will get picked up due to our
> llvm/.clang-format file.
>
> The diff being large or small shouldn't be a problem when the only change
> to the file is "applied clang-format. NFC".
>
>   Filipe
>
> On Fri, Jun 12, 2015 at 10:40 AM, Alexey Samsonov <vonosmas at gmail.com>
> wrote:
>
>> Yeah, AddressSanitizer.cpp was originally written (and updated) with
>> Google style, but I think that it resides in LLVM for too long that we
>> should migrate it eventually.
>> For instance, it makes hard to move the code to/from this file from
>> another parts of LLVM.
>>
>> On Fri, Jun 12, 2015 at 8:46 AM, Alexander Potapenko <glider at google.com>
>> wrote:
>>
>>> I've asked Dima and he told me we've used Google style previously,
>>> this was also my impression.
>>> I think I've tried the default style and the diff was larger.
>>>
>>> On Fri, Jun 12, 2015 at 5:42 PM, Alexey Samsonov <vonosmas at gmail.com>
>>> wrote:
>>> > Why don't we use LLVM style instead?
>>> >
>>> > On Fri, Jun 12, 2015 at 4:27 AM, Alexander Potapenko <
>>> glider at google.com>
>>> > wrote:
>>> >>
>>> >> Author: glider
>>> >> Date: Fri Jun 12 06:27:06 2015
>>> >> New Revision: 239601
>>> >>
>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=239601&view=rev
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239601-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=CKkF-kcf_iKeNpk4ow6p1bActflH0MWhwxSeFleM7vo&s=kiLfkdV4vJlltiJdSaaj-yS9Bi1Luqz2ThlyijPvYsA&e=>
>>> >> Log:
>>> >> [ASan] format AddressSanitizer.cpp with `clang-format -style=Google`,
>>> NFC
>>> >>
>>> >> Modified:
>>> >>     llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> >>
>>> >> Modified:
>>> llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> >> URL:
>>> >>
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=239601&r1=239600&r2=239601&view=diff
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Transforms_Instrumentation_AddressSanitizer.cpp-3Frev-3D239601-26r1-3D239600-26r2-3D239601-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=CKkF-kcf_iKeNpk4ow6p1bActflH0MWhwxSeFleM7vo&s=LD0OqRY8FkLfHFnqO3LWRXOgMJ26qcy9FGONZKqJ-88&e=>
>>> >>
>>> >>
>>> ==============================================================================
>>> >> --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> >> (original)
>>> >> +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> Fri Jun
>>> >> 12 06:27:06 2015
>>> >> @@ -106,10 +106,8 @@ static const char *const kAsanUnpoisonSt
>>> >>  static const char *const kAsanOptionDetectUAR =
>>> >>      "__asan_option_detect_stack_use_after_return";
>>> >>
>>> >> -static const char *const kAsanAllocaPoison =
>>> >> -    "__asan_alloca_poison";
>>> >> -static const char *const kAsanAllocasUnpoison =
>>> >> -    "__asan_allocas_unpoison";
>>> >> +static const char *const kAsanAllocaPoison = "__asan_alloca_poison";
>>> >> +static const char *const kAsanAllocasUnpoison =
>>> >> "__asan_allocas_unpoison";
>>> >>
>>> >>  // Accesses sizes are powers of two: 1, 2, 4, 8, 16.
>>> >>  static const size_t kNumberOfAccessSizes = 5;
>>> >> @@ -410,8 +408,7 @@ struct AddressSanitizer : public Functio
>>> >>    /// If it is an interesting memory access, return the
>>> PointerOperand
>>> >>    /// and set IsWrite/Alignment. Otherwise return nullptr.
>>> >>    Value *isInterestingMemoryAccess(Instruction *I, bool *IsWrite,
>>> >> -                                   uint64_t *TypeSize,
>>> >> -                                   unsigned *Alignment);
>>> >> +                                   uint64_t *TypeSize, unsigned
>>> >> *Alignment);
>>> >>    void instrumentMop(ObjectSizeOffsetVisitor &ObjSizeVis,
>>> Instruction *I,
>>> >>                       bool UseCalls, const DataLayout &DL);
>>> >>    void instrumentPointerComparisonOrSubtraction(Instruction *I);
>>> >> @@ -588,7 +585,7 @@ struct FunctionStackPoisoner : public In
>>> >>                                          Value *SavedStack) {
>>> >>      IRBuilder<> IRB(InstBefore);
>>> >>      IRB.CreateCall(AsanAllocasUnpoisonFunc,
>>> >> -                    {IRB.CreateLoad(DynamicAllocaLayout),
>>> >> +                   {IRB.CreateLoad(DynamicAllocaLayout),
>>> >>                      IRB.CreatePtrToInt(SavedStack, IntptrTy)});
>>> >>    }
>>> >>
>>> >> @@ -1706,8 +1703,7 @@ void FunctionStackPoisoner::poisonStack(
>>> >>    if (ClInstrumentAllocas && DynamicAllocaVec.size() > 0) {
>>> >>      // Handle dynamic allocas.
>>> >>      createDynamicAllocasInitStorage();
>>> >> -    for (auto &AI : DynamicAllocaVec)
>>> >> -      handleDynamicAllocaCall(AI);
>>> >> +    for (auto &AI : DynamicAllocaVec) handleDynamicAllocaCall(AI);
>>> >>
>>> >>      unpoisonDynamicAllocas();
>>> >>    }
>>> >> @@ -1901,9 +1897,9 @@ void FunctionStackPoisoner::poisonAlloca
>>> >>    // For now just insert the call to ASan runtime.
>>> >>    Value *AddrArg = IRB.CreatePointerCast(V, IntptrTy);
>>> >>    Value *SizeArg = ConstantInt::get(IntptrTy, Size);
>>> >> -  IRB.CreateCall(DoPoison ? AsanPoisonStackMemoryFunc
>>> >> -                          : AsanUnpoisonStackMemoryFunc,
>>> >> -                 {AddrArg, SizeArg});
>>> >> +  IRB.CreateCall(
>>> >> +      DoPoison ? AsanPoisonStackMemoryFunc :
>>> AsanUnpoisonStackMemoryFunc,
>>> >> +      {AddrArg, SizeArg});
>>> >>  }
>>> >>
>>> >>  // Handling llvm.lifetime intrinsics for a given %alloca:
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> llvm-commits mailing list
>>> >> llvm-commits at cs.uiuc.edu
>>> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Alexey Samsonov
>>> > vonosmas at gmail.com
>>>
>>>
>>>
>>> --
>>> Alexander Potapenko
>>> Software Engineer
>>>
>>> Google Germany GmbH
>>> Dienerstraße 12
>>> 80331 München
>>>
>>
>>
>>
>> --
>> Alexey Samsonov
>> vonosmas at gmail.com
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150612/c3154fc4/attachment.html>


More information about the llvm-commits mailing list